.net中的configurationManager

来源:百度知道 编辑:UC知道 时间:2024/05/11 14:19:06
将05中的代码SqlConnection myConnection =new SqlConnection(ConfigurationManager.ConnectionString["SQLCONNECTIONSTRING"].ConnectionString);
复制到03中去 发现找布道命名空间或者类型为"configurationManager"
应该怎么去解决这个问题

configurationManager是VS2005中的新特性,在03中是这样的:
首先引入命名空间System.web.Configuration
然后把你这一句改成:
SqlConnection myConnection =new SqlConnection(ConfigurationSettings.AppSettings["SQLCONNECTIONSTRING"]);

System.web.Configuration
System.data
System.data.sqlclient

System.web.Configuration
这个命名空间

引用System.web.Configuration了吗?