[thelist] best practice question

Casey Crookston caseyc at IntelliSoftmn.com
Tue Aug 8 13:15:36 CDT 2006


This is not a specific question, but a "what's the most efficient way
to..." question.  In dealing with connection strings, the actual string
itself is of course in the web.config file.  But, when referring to the
connection using: 

 

Dim dbConnect As SqlConnection = New
SqlConnection(ConfigurationSettings.AppSettings("dataConnection"))

 

What's the best method to keep from repeating this line in each and
every .ascx or .aspx file?  In other words, I'd like dbConnect to be a
global object that I don't need to instantiate on every page, and
certainly not within every function.  For example, could this line be
included in the global.asax file? And if so, in what sub?

 

Thanks!

 

Casey




More information about the thelist mailing list