日期:2014-05-19  浏览次数:20663 次

大家帮我看看
警告 1 “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This   method   is   obsolete,   it   has   been   replaced   by   System.Configuration!System.Configuration.ConfigurationManager.AppSettings”


我用的是2005我不知道怎么引用System.Configuration  


请帮忙

------解决方案--------------------
SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings[ "yourConnectionString "].ConnectionString);
------解决方案--------------------
这是03里的写法,ms会保持向下兼容,所以没有问题,只是给你了警告提示。
------解决方案--------------------
只是让你用新方法:System.Configuration.ConfigurationManager.AppSettings
------解决方案--------------------
config里写:
<appSettings/>
<connectionStrings>
<add name= "connectionString " connectionString= "Server=localhost; user id=sa; pwd=;database=purchase "/>
</connectionStrings>
程序里这样:

SqlConnection cn= new SqlConnection(ConfigurationManager.ConnectionStrings[ "ConnectionString "].ConnectionString);