Add a connection string to app.config runtime
Add the System.Configuration reference to your project.
Using this namespace in your code.
And use this code segment to add the new connection string:
Configuration myConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
myConfig.ConnectionStrings.ConnectionStrings.Add(new ConnectionStringSettings("ConnStr1", strConn));
myConfig.Save();
0 comments:
Post a Comment