ASP.NET数据库连接字符串写在config.web配置文件中

时间:2022-03-31 13:15:37
using System.Configuration; //添加引用 
//具体调用
private static string CONNECTION_STRING = ConfigurationManager.ConnectionStrings["dbconstr"].ConnectionString;
//配置文件下
<connectionStrings>
<add name="dbconstr" connectionString="Data Source=数据库服务地址;Initial Catalog=数据库名;Integrated Security=false;User ID=sa;Password=sa"/>
</connectionStrings>

http://blog.csdn.net/rart2008/article/details/5779784/