web.config中两个连接数据库
web.config中两个连接数据库
<appSettings> </appSettings>
<add name="ConnectionString" connectionString="Data Source=admin-pc;Initial Catalog=Northwind; User ID=sa;Password=" providerName="System.Data.SqlClient" /> </connectionStrings>
使用ConfigurationManager时需要引用 System.Configuration.dll System.Configuration.ConfigurationManager.ConnectionStrings[1].ConnectionString.ToString() : //序号从1开始 System.Configuration.ConfigurationManager.AppSettings[0].ToString();//序号从0开始 |
posted on 2010-05-30 14:44 Master zhu 阅读(187) 评论(0) 编辑 收藏 举报