should not need any configuration file, make sure 1. enable TCP/IP protocol in Server Network Utility and Client Network Utility2. create an account with SQL Authentication method3. try connection string like
"Server=YourServerMachineName;Database=YourDBName;UID=YourSQLLoginName;PWD=YourSQLLoginPassword;"for example, you normally can do withusing System.Data.SqlClient;SqlConnection conn = new SqlConnection("Server=localhost;Database=pubs;UID=sa;PWD=;");
if your web server is on the same machine as the SQL Server 2000, and you still have the default sa accountGood luck!

解决方案 »

  1.   

    不需要什么特定的文件,如果你想用web.config来用一个key来表示的话可以在web.config文件中这样写:
    <configuration>
    .
    .
    .
        <appSettings>
    <add key="server1" value="initial catalog=;data source=机器名;user id=用户名;pwd=密码"/>
        </appSettings>
    </configuration>在代码中引用的时候就这样写:
    Dim sql As String = System.Configuration.ConfigurationSettings.AppSettings("server1")
    Dim cn As New System.Data.SqlClient.SqlConnection(sql)
    cn.open
    当然要加上Imports System.Data
              Imports System.Data.SqlClient如果你想每次多自己在页面上写就按照上面那位大哥所说的那样去做吧。
      

  2.   

    那请各位大大帮我看看我的这段代码有何不妥:
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.SqlClient" %>
    <html>
    <script language="C#" runat="server">
      protected void Page_Load(Object sender, EventArgs e)
      {
      SqlConnection myConnection=new SqlConnection
      ("server=(local);database=numberone; trusted_Connection=yes");
      SqlDataAdapter myCommand=new SqlDataAdapter("select * from Tab_base",
      myConnection);
      DataSet ds =new DataSet();
      myCommand.Fill(ds,"Tab_Base");
      MyDataGrid.DataSource=ds.Tables["Tab_Base"].DefaultView;
      MyDataGrid.DataBind();
    }
    </script>
    <body>
    <h3>清单</h3><ASP:DataGrid id="MyDataGrid" runat="server"
     AutoGenerateColumns="False"
     BackColor="#ccccff"
     BorderColor="black"
     ShowFooter="false"
     CellPadding=3
     CellSpacing="0"
     Font-Name="Verdana"
     Font-size="8pt"
     HeaderStyle-BackColor="#aaaadd"
     EnableViewState="false" >
     <Columns>
         <asp:BoundColumn HeaderText="姓名" DataField="Tab_Name"/>
         <asp:BoundColumn HeaderText="性别" DataField="Tab_Sex"/>
         <asp:BoundColumn HeaderText="民族" DataField="Tab_Age"/>
      </Columns>
    </asp:DataGrid>
    </body>
    </html>  
    注:我的numberone数据库与aspx文件放在同一目录
    错误提示:
    运行时错误 
    说明: 服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。但可以通过在本地服务器计算机上运行的浏览器查看。 详细信息: 若要使他人能够在远程计算机上查看此特定错误信息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 <customErrors> 标记。然后应将此 <customErrors> 标记的“mode”属性设置为“Off”。
    <!-- Web.Config 配置文件 --><configuration>
        <system.web>
            <customErrors mode="Off"/>
        </system.web>
    </configuration>
     注释: 通过修改应用程序的 <customErrors> 配置标记的“defaultRedirect”属性,使之指向自定义错误页的 URL,可以用自定义错误页替换所看到的当前错误页。
    <!-- Web.Config 配置文件 --><configuration>
        <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
        </system.web>
    </configuration>
     
      

  3.   

    设置<customErrors mode="Off"/>后,你就知道那儿错了。
      

  4.   

    自定义错误信息
              设置 customErrors mode="On" 或 "RemoteOnly" 以启用自定义错误信息,或设置为 "Off" 以禁用自定义错误信息。
              为每个要处理的错误添加 <error> 标记。
    能解释一下上面是什么意思?
      

  5.   

    我看不出你的代码有什么错误,可能是你的机子配置原因,你的电脑能正常运行普通aspx文件么?
      

  6.   

    我在web.cinfig里添加了如下的代码:    <appSettings>
                <add key="conn" value="www.asp.net" />
        </appSettings>当我执行时,提示如下错误:无法识别的配置节“appSettings”我已确定添加的位置是对的,如何解决啊