日期:2014-05-18  浏览次数:20529 次

在web.config定义的数据库连接怎么用在cs代码中
用控件的话可以这样
ConnectionString= " <%$   ConnectionStrings:ConnectionString   %> "

那在cs代码中呢

------解决方案--------------------
ConfigurationManager.AppSettings[ " "];
ConfigurationManager.ConnectionStrings[ " "];
------解决方案--------------------

string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings[ "connectionString "];
------解决方案--------------------
System.Configuration.ConfigurationManager.ConnectionStrings[ ".... "].ConnectionString;