Link to home
Start Free TrialLog in
Avatar of alokanant
alokanant

asked on

ADO Connection Object

When I am closing an ado connection object using the command (conts.close) I get the following error message:

"Unhandled exception in VB6.EXE (MSADO15.DLL):0xC0000005: Access Violation"

The error occurs on some machines, while it does not occur on others.

Please help me out.

Thank You.
Avatar of ketapillar
ketapillar

Try this where conn1 is you connection object

If conn1.state <> adStateClosed Then conn1.close
Set conn1 = Nothing


Avatar of alokanant

ASKER

I have checked the status of the connection object, it is adStateOpen before I attempt to close the database.
ASKER CERTIFIED SOLUTION
Avatar of rpai
rpai

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have built the application using Visual Studio 6, Service Pack 5.

The PC on which the problem occurs does not have Visual Studio. All the machines on which I am testing the application run on Windows 2000 Service Pack 2.
I have built the application using Visual Studio 6, Service Pack 5.

The PC on which the problem occurs does not have Visual Studio. All the machines on which I am testing the application run on Windows 2000 Service Pack 2.
Perhaps u are not cheching the status of ur connection before closing the connection. Try it before closing the connection.
If conts.state <> 1 Then
   conts.close
   set conts = nothing
Yet another cause could be an incorrect reference. Or
probably an incorrect tear-down of an ActiveX control in your application.

Also, take a look at this article.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q248837

Hope this helps.
mubashar_iqbal_cs:
I have already checked the status of the connection object.

rpai:
what do you mean by "incorrect tear-down of an ActiveX control". How can I check whether this is happening in my application
Incorrect reference could be the potential cause.
Maybe the version of ADO.

To check if its your application might be causing this error, you need to code for appropriate error handlers.

On Error Goto ErrHandler
.
.
. 'Your code
.
Exit Function
ErrHandler:
 App.LogNTEvent Err.Description
Check MSADO15.DLL, there are several weird versions. The one dated 27/11/2000 works OK (with Vb5 anyway)
Avatar of DanRollins
Hi alokanant,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept rpai's comment(s) as an answer.
    *** Also, nobody said: Update MDAC on failing computer.

alokanant, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange