• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

ASP Proper DB Cleanup

powerman

Gawd
Joined
May 21, 2002
Messages
562
I am running IIS with classic ASP and I am having issues loading some of my
pages. I get an error that says:

"The requested resource is in use. "

What I want to do is have a function to open the database in an include
file. This code will be used over and over so it needs to be in one spot.
Here is the code that I am using in an include file named DB.inc:

Public Sub ConnectToDB2(byref XCmd, byref YRS, byRef Conn)


'this function connects to the database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Mode = 3
Conn.Open ("DRIVER={MySQL ODBC 3.51
Driver};SERVER=localhost;DATABASE=DB;USER=admin;PASSWORD=blahblahblah;OPTION=3;")

Set XCmd= Server.CreateObject("ADODB.Command")
XCmd.ActiveConnection = Conn
Set YRS = Server.CreateObject ("ADODB.Recordset")
end Sub

In my pages, I open the database by calling ConnectToDB2 ObjCmd, ObjRS,
ObjCon At the end of the page, I clean everything up like this:

Set ObjRS = Nothing
Set ObjCmd = Nothing
ObjCon.Close
Set ObjCon = Nothing

Any ideas why I keep getting the resource in use errors? I have several
include files but the database in opened in my page. The page includes the
inc files that manipulate the data from the DB. To have only one DB
connection object, I open the DB only once in my page and clean it up at the
end.

Thanks for any ideas.
 
Back
Top