Edit connection string dynamically

Topics: Data Access Application Block, General discussion
Aug 2, 2007 at 10:56 PM
I edited and saved the connection string then called the ConfigurationManager.RefreshSection("connectionStrings");. If in debug mode I call ConfigurationManager.ConnectionString0 from the Imediate window it returns the old connection string ( if i was to let it run it would fail when the db call is made). If I view the file (bin\Degub\Appname.exe.config ) it has the updates. Is there any other way other than the RefreshSection (which appears not to work) to force it to re-read the connection string?

//create a connection string builder;
SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();
sqlBuilder.DataSource = sqlServerName;
sqlBuilder.UserID = dbUserName;
sqlBuilder.WorkstationID = MachineName;
sqlBuilder.Password = Password;
sqlBuilder.InitialCatalog = sqlDataBaseName;
sqlConString = sqlBuilder.ConnectionString;

Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
ConnectionStringSettings conStrSettings = new ConnectionStringSettings(sqlConStringName, sqlConString,"System.Data.SqlClient");