AndersonHitchen
asked on
ASP include closing conn
Hi
I have an include that is set at the footer of my pages to close connections. It is returning the following error
Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClos e.asp, line 2
The include code is as follows
It's an old site that I have been ask to get working, looked for the error problem probably something simple but I can not see it.
Cheers Marcus
I have an include that is set at the footer of my pages to close connections. It is returning the following error
Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClos
The include code is as follows
MM_Connilease_STRING.Close()
Set Connilease = Nothing
It's an old site that I have been ask to get working, looked for the error problem probably something simple but I can not see it.
Cheers Marcus
this code is assuming is some kind of object, like a recordset or connection object. you'll probably want to check the other object and see if it's "state" is not closed (state = 0):
If MM_Connilease_STRING.State <> 0 then
MM_Connilease_STRING.Close ()
End if
if Connilease <> 0 then
Set Connilease = Nothing
end if
If MM_Connilease_STRING.State
MM_Connilease_STRING.Close
End if
if Connilease <> 0 then
Set Connilease = Nothing
end if
ASKER
Hi Big Monty
Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClos e.asp, line 5
Thats the error I got with that
Cheers M
Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClos
Thats the error I got with that
Cheers M
what kind of objects are MM_Connilease_STRING and Connilease?
ASKER
connilease is the connection that opens the recordset for the search results. MM_connilease_string is the main site connection which is included at the top of each page.
It is used in the dropdown select search.
Cheers
It is used in the dropdown select search.
Cheers
forgot the check on the "state" property for the second object, it should be:
If MM_Connilease_STRING.State <> 0 then
MM_Connilease_STRING.Close ()
End if
if Connilease.State <> 0 then
Set Connilease = Nothing
end if
If MM_Connilease_STRING.State
MM_Connilease_STRING.Close
End if
if Connilease.State <> 0 then
Set Connilease = Nothing
end if
ASKER
Hi
Changed it to that but still getting the same error on line 5
Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClos e.asp, line 5
I can not see any other connections created
Cheers M
Changed it to that but still getting the same error on line 5
Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClos
I can not see any other connections created
Cheers M
Then that means those objects are destroyed elsewhere in another page. If you are getting the errors in all of your pages then you can just remove those lines of code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked thank you. could you explain why this is rather than the one that was being used?
thanks again M
thanks again M
ASKER
resolved the issue thanks
this works because it first checks to see if MM_Connilease_STRING is an object in memory (if it isn't and you try to close something on an object that doesn't exist, it fails, right?), if it exists then it it runs through the code to destroy the object
If MM_Connilease_STRING.State
MM_Connilease_STRING.Close
End if
Set Connilease = Nothing