本帖最后由 lixubingaihong 于 2012-08-13 16:24:43 编辑

解决方案 »

  1.   

    但是现在要求我做的事:在安装时执行数据库脚本,势必要求用户输入服务器名,数据库名,用户名和密码,并且这些信息要写到web.config以便日后连接数据库使用。这些我都实现了,现在 要添加另一种windows 身份验证方式,即用户也可以不输入用户名和密码。我就不清楚怎么同时实现选择,实现任意一种的页面怎么弄。只有一种的时候,我就简单的在用户界面添加一个文本框(A)就可以了。
      

  2.   

    可以先试一试ADO.NET Data Connection dialog是不是可以使用。
    参考:
    http://erikej.blogspot.com.au/2010/04/using-adonet-data-connection-dialog-in.html
      

  3.   

    这篇文章说了创建任意对话框,在setup中使用How to create custom dialog boxes using the Web Setup Project in Visual Studio 2010
    http://www.codeproject.com/Articles/181395/How-to-create-custom-dialog-boxes-using-the-Web-Se
      

  4.   


    Using the ADO.NET Data Connection dialog in your own application – and limiting the choice of data sources
    In version 3.0 of the ExportSqlCE SSMS add-in, I have used the newly released Visual Studio ADO.NET Add Data Connection dialog to prompt the user for connection information to the server. This dialog is now available in source code here.This project consists of this well-know dialog (and others) – used in the Visual Studio Server Explorer:
    For the purpose of the add-in, I was interested in on the Microsoft SQL Server data source, as this was the target of the scripting code.This was achieved in the following way:
    using Microsoft.Data.ConnectionUI;

    DataSource sqlDataSource = new DataSource("MicrosoftSqlServer", "Microsoft SQL Server");
    sqlDataSource.Providers.Add(DataProvider.SqlDataProvider);
    DataConnectionDialog dcd = new DataConnectionDialog();
    dcd.DataSources.Add(sqlDataSource);
    dcd.SelectedDataProvider = DataProvider.SqlDataProvider;
    dcd.SelectedDataSource = sqlDataSource;
    if (DataConnectionDialog.Show(dcd) == DialogResult.OK)
    {
        string connectionString = dcd.ConnectionString;
    The result is the following dialog, notice that the Change… button is disabled:
      

  5.   

    这个刚好不可以做我的。
    There are a few limitations though, which are listed below:You have no access whatsoever over the controls in the dialog box; for example, you would want to have a Form where the user checks the “Windows Authentication” option and you would want to hide the username and password fields provided for SQL Server authentication. This cannot be achieved using the predefined dialog boxes.
      

  6.   

    选择=》触发事件=》填入2或4个变量=》执行代码加载数据库和修改web.config
     我知道可以这样子,但是这样不就是分两次执行代码了吗?怎么在页面之间插入事件?
      

  7.   

    我用VB代码写了一个form,然后在form里面的确认处理函数会执行一个sql脚本来加载数据库,但是现在怎么也获取不到.sql脚本路径。
    form是用的windows form application 项目写的,然后再用install 类调用显示。最后类库再输出到web安装程序。 
    如何获取到.sql的脚本路径?