webconfig得简单问题
2005中用ConfigurationSettings.AppSettings[ "ConnectionString "].ToString();
读取config中得连接语句提示已过时,用System.Configuration.ConfigurationManager.AppSettings代替,但是为什么System.Configuration下面找不到ConfigurationManager这个方法呢?
------解决方案--------------------加引用: using System.Web.Configuration;
CS文件里调用:
string connStr = WebConfigurationManager.ConnectionStrings[ "testExport "].ToString();
SqlConnection conn = new SqlConnection(connStr);