FAQ: Databases in Visual Basic 4.0

Last reviewed: August 25, 1997
Article ID: Q142000
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic for Windows, 16-bit and 32-bit, version 4.0

SUMMARY

This article covers some of the most Frequently Asked Questions (FAQ) about non-technical issues for Microsoft Visual Basic for Windows. You can find this and other FAQ articles by querying on the keyword "FAQ." You can find additional general references in the Microsoft Knowledge Base by searching on "article list."

The Visual Basic 3.0 FAQ covering databases may contain additional information regarding a portion of these questions. This FAQ is in the process of being completed. More frequently asked questions will be added to this article by the end of January 1996.

MORE INFORMATION

This article deals with the following questions:

  1. What is FreeLocks and when should I use it?
2. When I run my query I get a syntax error with my SQL statement. 3. Can I call a stored procedure on my ODBC database? 4. How can I program my Visual Basic program to work on a network with
   multiple users running my database program.
5. My Microsoft Access 2.0 database has become corrupted and I can't get
   it back to normal. What do I do?
6. What is the difference between the Seek and Find methods? 7. Why am I having problems locking a database on a Novell server?

Questions and Answers

1. Q. What is FreeLocks and when should I use it?

   A. Freelocks should be the most frequently used statement you use when
      writing database code. Because Jet (the data access engine VB uses)
      is not multithreaded, it relies on its clients (your Visual Basic
      app) to give it the opportunity to do cleanup work. FreeLocks is that
      mechanism.

      Consider just adding records. Jet will allocate memory in order to
      keep track of locks; even after those locks are released, that
      memory is still allocated. Jet will allocate about 1.5 K for every 8-
      30 records added. FreeLocks releases locks made during the add
      process, as well as the memory that was allocated to store them.

      Those locks in that allocated memory may also still be in effect as
      well. Access will catch up to them sooner than it will free the
      actual memory, but why take chances?

2. Q. When I run my query, I get a syntax error with my SQL statement.

   A. There could be a number of things wrong with your SQL statement to
      get this error; we recommend that you use the QBE (Query By Example)
      tool in Access to test and build your SQL statements. Then copy and
      paste the SQL syntax built in the QBE tool into your Visual Basic
      program.

      For additional information, please see the following article in
      the Microsoft Knowledge Base:

      ARTICLE-ID: Q105173
      TITLE     : How to Query for Dates Using a SQL Statement in Visual
                  Basic

3. Q. Can I call a stored procedure on my ODBC database?

   A. Yes, you can.

4. Q. How can I program my Visual Basic program to work on a network with
      multiple users running my database program.

   A. You will need to set up some error trapping routines so that you can
      continue when multi-user conflict (errors) occur.

5. Q. My Microsoft Access 2.0 database has become corrupted and I can't get
      it back to normal. What do I do?

   A. The corruption can occur in a specific object in the database, such
      as a table. If that is the case, then try the following steps to
      create a "clean" database:

      a. From within Microsoft Access, export the table to an ASCII file.
      b. Delete the table from the database.
      c. Compact the database.
      d. Re-create the table and any relationships it had.
      e. Examine the ASCII file for bad or strange data and remove those
         records.
      f. Re-import the ASCII file into the newly re-created table.
      g. Re-create any records you were forced to delete.

6. Q. What is the difference between the Seek and Find methods?

   A. The find methods (FindFirst, FindLast, FindNext, and FindPrevious)
      apply to Dynasets and Snapshots but not to Table objects.
      Conversely, the Seek method is available only on the Table object.

      The Seek method is significantly faster than the find methods. It is
      also more flexible because you can change the Index property of the
      Table object to change the order of the Seek. For intensive
      searches, you may want to create a Table object so that you can use
      the Seek method along with the find methods on the open Dynasets.

7. Q. Why am I having problems locking a database on a Novell server?

    A. There are Knowledge Base articles in the Microsoft Access Knowledge
       Base that deal with Novell issues:

       For additional information, please see the following articles in
       the Microsoft Knowledge Base:

       ARTICLE-ID: Q121462
       TITLE     : Obtaining Latest Novell Client Windows Drivers and DLLs

       ARTICLE-ID: Q109400
       TITLE     : INF: README.TXT File and Novell Locking Issues

       ARTICLE-ID: Q102522
       TITLE     : PRB: "Record Lock Threshold Exceeded" with Large Action
                   Query

       ARTICLE-ID: Q113564
       TITLE     : INF: Microsoft Access 2.0 Readme Help File Contents
Keywords          : APrgData kbfaq
Version           : 4.0
Platform          : NT WINDOWS


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.