I have a console application which gets the connectionstring as a parameter. I would have to set a ConnectionString in app.config with name 'ConnectionString' and the given parameter as the sql connectionstring.
Thx to answers. With help of the links I got to this:
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var connectionStringSettings = new ConnectionStringSettings("ConnectionString", _arguments["connectionString"], "System.Data.SqlClient"); config.ConnectionStrings.ConnectionStrings.Add(connectionStringSettings); config.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("connectionStrings");