I write class when the program run, it check Connection to SQL Server. if the connection is not Ok, the new form Show up and ask for ServerName, DBName, UserName, and Password , then check the connection again if it is Ok it enter the program
I write Code if new information For connection Ok It save in App.Config But It doesn't Work
public static void SaveToConfig(string key,string value)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings[key].Value = value;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}