ASP.NET程序web.config连接Mssql数据库字符串大全

常见的asp.NET程序连接mssql数据库的字符串使用方法;
在Web.Config中创建连接字符串:
1、asp.net连接Access数据库代码:

/


<add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|grade.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />

2、asp.net连接mssql数据库代码:

/


<add name="sampleConnectionString" connectionString ="server=.SQLEXPRESS;database=sample;uid=sa;pwd=123456;" providerName ="System.Data.SqlClient"/>

/


<add name ="testConnectionString" connectionString ="Data Source=.SQLEXPRESS;Initial Catalog=sample;Integrated Security=True;Persist Security Info=True;User ID=sa;Password=123456" providerName ="System.Data.SqlClient"/>

/

  <connectionStrings>
       <add name="SqlDB" connectionString="Data Source=sql.123.vhostgo.com;Initial Catalog=hmesepims;Integrated Security=False;uid=hmesepims;pwd=ly001112" providerName="System.Data.SqlClient" />
  </connectionStrings>

你可能感兴趣的