 |
suryasatya Level: Big Cheese
 Registered: 08-08-2006 Posts: 20
|
DAO closing Data Base
Hi All,
I am developing an applcation using VB6 and DAO.
I have opened the database exclusively at one point and closed at another point.
I wanted to check whether database has closed correctly or not. Is there any mechanisum to test this scenario...
can any one provide code snippet for the same.
please help... this is urgent...
Thanks,
Surya.
____________________________
surya satya
|
|
16-02-2007 at 05:24 AM |
|
|
yronium Level: Moderator

 Registered: 14-04-2002 Posts: 908
|
Re: DAO closing Data Base
Hello. Firmly keeping in mind that you better move to ADO as soon as possible, and that MSAccess is not the most performant solution for any multiuser application, the first thing I would check is whether you set your db variable to Nothing after closing it.
Usually ADO/DAO explicitly create an instance of the recordset object when you set it to anything by the Set instruction. In most cases this happens when the code reaches the Set db = New Database instruction. The data provider allocates a certain amount of memory space. Normally, this space can be released when it becomes unnecessary, but how can ADO/DAO know we don't need it anymore? So the correct practice is to explicitly set it to Nothing after have closed it. But look: if you have some data consumer that's still connected and retrieving data, the memory space is not released and the connection is kept alive until the data flow is finished.
So check if you explicitly set your variable on Nothing after having closed it, and check if you have any data consumer - say, a control, a form, a routine, an ActiveX, whatever - that you started filling and forgot to stop. Check also if you used any DoEvents instruction after db closing, as in this case you started closing and destroying the object, but something else could try to access it again, mantaining it alive in fact.
Hope it helps.
____________________________
Real Programmer can count up to 1024 on his fingers
|
|
19-02-2007 at 05:16 PM |
|
|
|
|
 |
 |