You can programatically open the configuration with using the System.configuration namespace: Configuration myConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); Then you can access the connection strings collection at: myConfig.ConnectionStrings.ConnectionStrings You can modify the collection however you want, and when done call .Save() on the configuration object.
Errors are like Mini Skirts, shorter they get, more revealing they become.