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/incClose.asp, line 2

The include code is as follows
MM_Connilease_STRING.Close()  
Set Connilease = Nothing

Open in new window


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
AndersonHitchenAsked:
Who is Participating?
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Otherwise you can try using the IsObject function:

If IsObject( MM_Connilease_STRING) then
    If MM_Connilease_STRING.State <> 0 then
       MM_Connilease_STRING.Close()  
    End if
End if

If IsObject( Connilease) then
   if Connilease.State  <> 0 then
       Set Connilease = Nothing
    end if
End if
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Try this:


If MM_Connilease_STRING.State <> 0 then
   MM_Connilease_STRING.Close()  
End if
Set Connilease = Nothing
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
AndersonHitchenAuthor Commented:
Hi Big Monty

Microsoft VBScript runtime error '800a01a8'
Object required: 'DRIVER={MySQL ODBC 5'
/carsauce/includes/incClose.asp, line 5


Thats the error I got with that

Cheers M
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
what kind of objects are MM_Connilease_STRING and Connilease?
0
 
AndersonHitchenAuthor Commented:
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
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
0
 
AndersonHitchenAuthor Commented:
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/incClose.asp, line 5

I can not see any other connections created

Cheers M
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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.
0
 
AndersonHitchenAuthor Commented:
That worked thank you. could you explain why this is rather than the one that was being used?

thanks again M
0
 
AndersonHitchenAuthor Commented:
resolved the issue thanks
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.