About, how to reduce number of connectionstring,
if you are using only one database as the datasource for your application then you may rename the name of connectionstring in all your databound controls like SQLDataSource, or if you are manually calling some Update, Delete or Insert function, then that also
would need changes in connectionstring. And after renaming all the connectionstring to a common name then you may add a ConnectionString in the WebConfig with the same name.
alok.arora
Contributor
3058 Points
530 Posts
Re: Sql Connection string from web.config?
Feb 08, 2009 06:25 PM|LINK
Hi,
About the error that you are getting, you are using the appSettings to get the connectionstring, instead use this:
[VB]
"ConnectionStringName").ConnectionStringSystem.Configuration.ConfigurationManager.ConnectionStrings(
[C#]
System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString
About, how to reduce number of connectionstring,
if you are using only one database as the datasource for your application then you may rename the name of connectionstring in all your databound controls like SQLDataSource, or if you are manually calling some Update, Delete or Insert function, then that also would need changes in connectionstring. And after renaming all the connectionstring to a common name then you may add a ConnectionString in the WebConfig with the same name.