[thelist] best practice question

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Tue Aug 8 14:01:33 CDT 2006


		You could do it when the application starts and load it into Cache...

				From: "Casey Crookston" caseyc at IntelliSoftmn.com

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