Global Connection String

Hoopla

New Member
Is there a way to have a connection string made global for every page in the app? I have done this with includes in asp. But I want to bind data to form objects (ie text fields) but I don't want to enter the connections string for every page. It creates a maintenance nightmare. Any suggestions?You can use global.asa or global.asax<BR><BR>But it is not recommended (performance). Because you must destroy your connection objects when its work finishes, not keep them in the application object.If you create a aspx-file, e.g. globals.aspx, with your globals that looks like this:<BR><BR><script runat="server"><BR>Const gConnString = "xxx"<BR></script><BR><BR>Yoy can include this one in all your aspx-files with the following directive st the top:<BR><BR><!-- #Include virtual="/somwhere/globals.aspx" --><BR><BR>This should work.<BR>I believe this is what the Web.config file is for.follow up here:<BR><BR>http://www.aspmessageboard.com/forum/ASPPlus.asp?M=368504&T=368401&F=36&P=1
 
Back
Top