web.config的数据库连接字符串写法与取法

<connectionStrings>
  <add name="Shop" connectionString="Server=10.245.113.97;Database=mall3;User id=sa;Password=;" providerName="System.Data.SqlClient"/>
 </connectionStrings>

 

SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Shop"].ConnectionString);

 

posted @ 2009-05-20 05:17  CoderWayne  阅读(294)  评论(0编辑  收藏  举报