Solved

ADO Connection Object

Posted on 2002-06-03
12
659 Views
Last Modified: 2013-11-23
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.
0
Comment
Question by:alokanant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 3

Expert Comment

by:ketapillar
ID: 7052138
Try this where conn1 is you connection object

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


0
 
LVL 2

Author Comment

by:alokanant
ID: 7052156
I have checked the status of the connection object, it is adStateOpen before I attempt to close the database.
0
 
LVL 5

Accepted Solution

by:
rpai earned 50 total points
ID: 7052220
Check the Service Pack installed on those machines that comes up with that error message. The access violation errors used to occur when unregistering an ATL DLL or EXE built with a version of Visual C++ prior to 6.0 on a computer with the Visual C++ 6.0 Atl.dll installed. This  was, however, fixed with Service Pack 3. So Service Pack lower than 3 could be a potential cause of the problem.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:alokanant
ID: 7052282
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.
0
 
LVL 2

Author Comment

by:alokanant
ID: 7052286
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.
0
 

Expert Comment

by:mubashar_iqbal_cs
ID: 7053395
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
0
 
LVL 5

Expert Comment

by:rpai
ID: 7053639
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.
0
 
LVL 2

Author Comment

by:alokanant
ID: 7054109
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
0
 
LVL 5

Expert Comment

by:rpai
ID: 7054691
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
0
 
LVL 3

Expert Comment

by:PNJ
ID: 7089932
Check MSADO15.DLL, there are several weird versions. The one dated 27/11/2000 works OK (with Vb5 anyway)
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7851451
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
0
 

Expert Comment

by:SpideyMod
ID: 7912931
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question