Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ADO recordset access violation problem

Posted on 2001-09-11
4
Medium Priority
?
290 Views
Last Modified: 2009-07-29
I have a COM object that writes an ADO recordset which is available as a property of the com object. IE

Object.writeADO

This object is used in an VB program which seems to run fine except when the application ends.  I get an access violation error at 0x00000005 that is found in the debug to be in the com object.

In fact I have been able to determine the problem is related specifically to when the object goes out of scope either by application termination or if the object is used in a procedure and the function goes out of scope.

Is there a particular set of code that needs to be executed to allow a recordset to be created and then the object destructed that I am not aware of?

0
Comment
Question by:edwinson
[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
  • 2
4 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6481596
Be certain to close the database connection.  Some drivers are not graceful when the app closes unexpectedly.

Which database engine are you using? ... I know that with the old Sybase runtime, I needed to close the connection, but allow the object to persist.  I just let the operating system clean up after I terminated.  I don't recommend that approach, but I suggest you try some variations to see if you can narrow down the locust of the error.

-- Dan
0
 
LVL 1

Author Comment

by:edwinson
ID: 6482636
We finally found a solution.  Microsoft's Q186387 and Q200122 both provided clues as well as some documentation we have on site.  We wanted to send a recordset object to a COM object, execute some statistical procedures, return a recordset with the result of the procedures.  Client is a VB application.

Basically what was happening is when the COM object went out of scope, it destroyed the recordset object reference.  This would normally be ok except that the VB program using the reference still needed the object.  

Thus we now have a set of code that checks to see if the object is still needed by another process before a complete destruction of the COM object takes place.
0
 
LVL 1

Author Comment

by:edwinson
ID: 6571072
We found our own solution as indicated by my final comments.  The one contribution was appreciated but not the cause or solution to the problem.  

Rather than award points and a low grade it is better to simply delete the question.
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7108835
User resolved; points refunded and question closed.

Netminder
CS Moderator
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

618 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