Click to See Complete Forum and Search --> : set the connectionString in web.config


biap
02-01-2007, 08:30 AM
I'm using ASP.NET with Visual Studio 2005 and I want to give the connection string in a textbox and then, from there take the value and set the connectionString in web.config? Is it possible to do that and how?

Chitra Xavier
02-02-2007, 04:26 AM
Hi..

Config class allows to read (and of course, write) to that section, as follows:
Config config = new Config();
config.GroupName = null; // don't use the "profile" group
...
string value = config.GetValue("appSettings", "App Entry", null);
config.SetValue("appSettings", "Update Date", DateTime.Today);

Hope this will help u