Set the db dynamically in web.config
-
Hi, I am using .net 2.0. I want to connect the db dynamically using web.config. I have to pass the db name only at runtime. The server name, uid, password are static in web.config. Please help me to implement this. Thanks.
Try to use
System.Web.Configuration
NameSpace There is a classWebConfigurationManager
.This class allow you to accss web.config programmaticaly. For Every Section in web.config there is a Class in this namespce, like For AppSettingsSection there is a classAppSettingsSection
, Similary for ConnectionString There is a ClassConnectionStringSection
. You can retreive information byWebConfigurationManager.GetSection()
. Now try to explore this area what ever i mention and try to implement. if you have anmy issue then ask me !!! Good luck :)cheers, Abhijit Read My Latest Article : Exploring Caching In Asp.net
-
Try to use
System.Web.Configuration
NameSpace There is a classWebConfigurationManager
.This class allow you to accss web.config programmaticaly. For Every Section in web.config there is a Class in this namespce, like For AppSettingsSection there is a classAppSettingsSection
, Similary for ConnectionString There is a ClassConnectionStringSection
. You can retreive information byWebConfigurationManager.GetSection()
. Now try to explore this area what ever i mention and try to implement. if you have anmy issue then ask me !!! Good luck :)cheers, Abhijit Read My Latest Article : Exploring Caching In Asp.net