In the overwhelming majority of cases the best place to put the connection
string(s) is in the web.config file.
Here's what the appSettings section of your web.config would look like:
<configuration>
<appSettings>
<add key="ConnectionString"
value="Server=(local);Database=DBName;UID=sa;PWD="/>
</appSettings>
</configuration>
This is a nice way to manage it. You can change the connection string
easily without rebuilding the app or restarting IIS or anything, and the
change goes into effect immediately.
Then in your code behinds you can get the connection string like this:
Dim sConn as string
sConn = ConfigurationSettings.AppSettings("ConnectionStrin g")
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Fernando Lopes" <fernandomattarlopes@[remove]msn.com> wrote in message
news:eJ**************@TK2MSFTNGP12.phx.gbl...
Hi there.
In your opinion, where is the best place to put the connection string of a
web application?
Web.config, a constant into the code?
I'm not using a component server, so it's not an option, ok?
Tks.
Fernando