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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
Try this:


If MM_Connilease_STRING.State <> 0 then
   MM_Connilease_STRING.Close()  
End if
Set Connilease = Nothing
0
Big MontyWeb Ninja at largeCommented:
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
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
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Big MontyWeb Ninja at largeCommented:
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 MontyWeb Ninja at largeCommented:
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 MontyWeb Ninja at largeCommented:
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
Big MontyWeb Ninja at largeCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 MontyWeb Ninja at largeCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.