ASP.Net 2.0 获取connectionStrings的方法
ASP.Net 2.0 中的System.Configuration下有n多个对象,读取ConnectionStrings在System.Configuration.ConfigurationManager之下,下面的方法可以获取到数据连结信息
string connectionString;
System.Configuration.ConnectionStringSettings connString = System.Configuration.ConfigurationManager.ConnectionStrings["NorthwindConnectionString"];
if(null != connString)
connectionString = connString.ConnectionString;
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)