Saving the connection string at runtime

Karthikanbarasan
Posted by Karthikanbarasan under ASP.NET category on | Points: 40 | Views : 2048
public static void AddAndSaveOneConnectionStringSettings(
System.Configuration.Configuration configuration,
System.Configuration.ConnectionStringSettings connectionStringSettings)
{
ConnectionStringsSection connectionStringsSection = configuration.ConnectionStrings;
connectionStringsSection.ConnectionStrings.Add(connectionStringSettings);
configuration.Save(ConfigurationSaveMode.Minimal);
// ConfigurationManager
ConfigurationManager.RefreshSection("connectionStrings");
}

Comments or Responses

Login to post response