FAQ: Databases in Visual Basic 4.0
ID: Q142000
|
The information in this article applies to:
-
Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 16-bit and 32-bit, for Windows, 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:
- What is FreeLocks and when should I use it?
- When I run my query I get a syntax error with my SQL statement.
- Can I call a stored procedure on my ODBC database?
- How can I program my Visual Basic program to work on a network with
multiple users running my database program.
- My Microsoft Access 2.0 database has become corrupted and I can't get
it back to normal. What do I do?
- What is the difference between the Seek and Find methods?
- Why am I having problems locking a database on a Novell server?
Questions and Answers
- 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?
- 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.
- Q. Can I call a stored procedure on my ODBC database?
A. Yes, you can.
- 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.
- 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:
- From within Microsoft Access, export the table to an ASCII file.
- Delete the table from the database.
- Compact the database.
- Re-create the table and any relationships it had.
- Examine the ASCII file for bad or strange data and remove those
records.
- Re-import the ASCII file into the newly re-created table.
- Re-create any records you were forced to delete.
- 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.
- 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