数据库连接字符串

引用:using System.Collections.Specialized;
web.config
<appSettings>
  <!--  ConnectString —— MS SQL Server 2000连接字串
    -->
  <add key="ConnectString" value="User ID=sa;password=;initial catalog=;data source=;Connect Timeout=30"/>
 </appSettings>
.cs  
strConn = ((NameValueCollection)Context.GetConfig("appSettings"))["ConnectString"].ToString();
   sqlConn = new SqlConnection(strConn);

你可能感兴趣的:(数据库连接)