從webcongif獲得連接數據庫的字符串

View Code
1 <connectionStrings>
2 <add name="front-end_Web" connectionString="Server=we\Saa;DataBase=database;User ID=sa;Pwd=123" />
3 <add name="back-end_Web" connectionString="Server=we\Saa;DataBase=database1;User ID=sa;Pwd=123" />
4 </connectionStrings>
5
6
7 string conn = System.Configuration.ConfigurationManager.ConnectionStrings["front-end_Web"].ConnectionString;
8 }

你可能感兴趣的:(Web)