private void UpdateConfig(string value) { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //ConfigurationManager. AppSettingsSection appSettings = config.AppSettings as AppSettingsSection; // Get the KeyValueConfigurationCollection // from the configuration. KeyValueConfigurationCollection settings = config.AppSettings.Settings; // Display each KeyValueConfigurationElement. foreach (KeyValueConfigurationElement keyValueElement in settings) { if (keyValueElement.Key == "dbConnectionString") { keyValueElement.Value = value; } } config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); }
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)