使用app.config中的数据对数据库链接信息初始化

看到别人数据库信息都是在app.config里面设置的,今天来尝试了一下,报了

"System.Configuration.ConfigurationSettings.AppSettings"已过期:"this method has obsolete,it has been repalced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings"

的警告,上网查了一下,得知需要在 引用  中添加引用选System.Configuration,然后确定,再在类上写  using System.Configuration;

接着把System.Configuration.ConfigurationSettings.AppSettings改成System.Configuration.ConfigurationManager.AppSettings

然后就没有报警告了。

原文地址:https://www.cnblogs.com/cellphoneyeah/p/5411682.html