?
Solved

ADO recordset access violation problem

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

762 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