FAQ: Databases in Visual Basic 4.0

ID: Q142000


The information in this article applies to:


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.




  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:

    1. From within Microsoft Access, export the table to an ASCII file.


    2. Delete the table from the database.


    3. Compact the database.


    4. Re-create the table and any relationships it had.


    5. Examine the ASCII file for bad or strange data and remove those records.


    6. Re-import the ASCII file into the newly re-created table.


    7. 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:

    Q121462 : Obtaining Latest Novell Client Windows Drivers and DLLs

    Q109400 : INF: README.TXT File and Novell Locking Issues




Q102522 : PRB: "Record Lock Threshold Exceeded" with Large Action Query

Q113564 : INF: Microsoft Access 2.0 Readme Help File Contents


Keywords          : kbDatabase 
Version           : 4.0
Platform          : NT WINDOWS 
Issue type        : 

Last Reviewed: June 7, 1999