borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Add Table to Access database)Next Topic (Opening Database for Exclusive Access) New Topic New Poll Post Reply
AndreaVB Forum : Database : DAO closing Data Base
Poster Message
suryasatya
Level: Big Cheese

Registered: 08-08-2006
Posts: 20

icon 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
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 908
icon Re: DAO closing Data Base

Hello. What do you mean by "closed correctly or not"?
And, what database are you connecting to?
And finally, why not using ADO instead of DAO? I read in the other thread of yours that you are quite new to DAO, so I wonder if you have a real need to use DAO. If you can, I firmly suggest you to move to ADO, more powerful, flexible, performant and reliable than DAO.
Hope it helps.

____________________________
Real Programmer can count up to 1024 on his fingers

16-02-2007 at 07:02 AM
View Profile Send Email to User Show All Posts | Quote Reply
suryasatya
Level: Big Cheese

Registered: 08-08-2006
Posts: 20
icon Re: DAO closing Data Base

Hi,

Actually the current project which i m working is developed in VB6 and DAO. So, My client dont wanted to change the existing technologies becoz its working fine from long time.

In our code we are using DAO to connect to MS Access DB exclusively. At one point of time we are opening DB connections and closing at other point. After that, we are calling EXE of customer( thru WIN API fn's) which opens the same DB exclusively and perform some operations on the same. But, their EXE waiting around 15 mins to get an access to DB. before that its throwing errors like "file is already in use".

How can I reduce this significant time we thought that our application not releasing DB handles when I am closing DB. Any ideas

This is very high priority issue. Please help!!!

Thanks.



____________________________
surya satya

19-02-2007 at 11:42 AM
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 908
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : DAO closing Data Base
Previous Topic (Add Table to Access database)Next Topic (Opening Database for Exclusive Access) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder