SqlHelper类获取webconfig中的数据库连接字符串

SqlHelper中获取webconfig中的数据库连接字符串

public static string ConnectionStringLocalTransaction = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["SqlConnStr"].ConnectionString;

webconfig

<connectionStrings>
 <add name="SqlConnStr" connectionString="Data Source=.;Initial Catalog=testdb;User ID=sa;Password=sqlserversa;"/> 
 </connectionStrings>

 

You may also like...

发表评论

电子邮件地址不会被公开。 必填项已用*标注