标签:
1 Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); 2 config.AppSettings.Settings.Remove("sqlStr"); 3 config.AppSettings.Settings.Add("sqlStr", sqlStr); 4 //一定要记得保存,写不带参数的config.Save()也可以 5 config.Save(ConfigurationSaveMode.Modified); 6 //刷新,否则程序读取的还是之前的值(可能已装入内存) 7 System.Configuration.ConfigurationManager.RefreshSection("appSettings");
标签:
原文地址:http://www.cnblogs.com/JoeyZJ/p/5725087.html