?
Solved

ADO recordset access violation problem

Posted on 2001-09-11
4
Medium Priority
?
291 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
  • 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

864 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