转自 “http://blog.csdn.net/jueane/article/details/8502553"
警告"System.Configuration.ConfigurationSettings.AppSettings”已过时,解决办法
string cnnStr = System.Configuration.ConfigurationSettings.AppSettings["cnn"];
得出以下的警告
“System.Configuration.ConfigurationSettings.AppSettings”已过时:“"This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings。
直接把ConfigurationSettings写成ConfigurationManager,但是提示没有ConfigurationManager语句。
于是,在VS右边的“解决方案”中点“引用”,在.net处引入System.configuration.
然后,在空间写上 Using System.Configuration;
最后,再把ConfigurationSettings写成ConfigurationManager。这样就OK了。
时间: 2024-10-05 14:36:41