A
Andyza
In my Global.asa file I have the following 2 subs for opening and
closing my db connection:
Sub OpenConn()
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open Application("ConnString")
End Sub
Sub CloseConn()
conn.Close
Set conn = nothing
End Sub
Then in my asp pages I simply call the subs when I need to open and
close the db connection.
Eg.:
Dim Test
Test = "Select XXX from SomeTable"
OpenConn()
Set rs = conn.Execute(Test)
Do While Not rs.eof
Response.Write(rs("XXX"))
rs.MoveNext()
Loop
CloseConn()
Is this good practice to have the 2 db subs in the Global.asa?
closing my db connection:
Sub OpenConn()
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open Application("ConnString")
End Sub
Sub CloseConn()
conn.Close
Set conn = nothing
End Sub
Then in my asp pages I simply call the subs when I need to open and
close the db connection.
Eg.:
Dim Test
Test = "Select XXX from SomeTable"
OpenConn()
Set rs = conn.Execute(Test)
Do While Not rs.eof
Response.Write(rs("XXX"))
rs.MoveNext()
Loop
CloseConn()
Is this good practice to have the 2 db subs in the Global.asa?