-
Closing Database Question
Hi,
I have a question concerning the closing of a database. I'm maintaining an
app written in VB6 and Access 97. The same database is openned in several
procedures using the OpenDatabase method, but I don't see where it's closed
in any of the procedures.
My question is, does an open database get closed automatically when exiting
a procedure? The reason I ask is that in one of the app's procedures a table
in the database is looped through to change a field's value in all records.
During this loop i'm getting a record locking error, even though i'm the
only user, so my suspicion is that i'm somehow locking myself out.
If anyone knows the answer to my question or can shed some insight into my
record locking problem i would definetely appreciate it.
Thanks,
Kevin McGuire
-
Re: Closing Database Question
It is good practice to always close a recordset as well as a database at the
end of the procedure. Your problem of being locked out could be due to the
fact that the database is opened in several procedures, but then never closed.
However, you should be able to make changes or gather information from a
table that is being use by more than one user or process. When you create
a recordset whether in ADO or DAO (I'm assuming you're using DAO since you're
using Access 97 as your back end) the open recordset function allows you
to set the lockedits so that you can make changes. Look in the help files,
at the index tab look for "OpenRecorset Method".
"Kevin McGuire" <Kevin.McGuire@WesternSouthernLife.com> wrote:
>
>Hi,
>
>I have a question concerning the closing of a database. I'm maintaining
an
>app written in VB6 and Access 97. The same database is openned in several
>procedures using the OpenDatabase method, but I don't see where it's closed
>in any of the procedures.
>
>My question is, does an open database get closed automatically when exiting
>a procedure? The reason I ask is that in one of the app's procedures a table
>in the database is looped through to change a field's value in all records.
>During this loop i'm getting a record locking error, even though i'm the
>only user, so my suspicion is that i'm somehow locking myself out.
>
>If anyone knows the answer to my question or can shed some insight into
my
>record locking problem i would definetely appreciate it.
>
>Thanks,
>Kevin McGuire
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks