Closing Database Question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Closing Database Question

  1. #1
    Kevin McGuire Guest

    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


  2. #2
    Gertrude Stokleberry Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center