INF: How and Where to Place VBSQL.VBX
ID: Q121881
|
The information in this article applies to:
-
Microsoft SQL Server version 4.2x
SUMMARY
This article explains the function VBSQL.VBX, where to place it, when to
load it, and when to unload it from memory.
MORE INFORMATION
There are a few basic rules you need to know when using the VBSQL.VBX to
create a Visual Basic Program for SQL Server (VBSQL). The VBSQL.VBX does
several things. It provides a simple way to trap SQL Server errors and
messages coming back from the SQL Server to the VB SQL Server front-end.
With out the VBSQL.VBX in an application on a form you could not trap any
SQL Server errors or messages. The error and message handlers in DB-Library
(DB-Lib) are call back functions, and they are implemented in the VBSQL.VBX
as events VBSQL1_Error and VBSQL1_Message.
The placement of the VBSQL.VBX instance in an application is very
important. The rules for placement are as follows:
- The VBSQL.VBX must be on the first form in memory.
- The VBSQL.VBX should be on the last form to be unloaded.
- Always use the form with the VBSQL.VBX on it as the startup form.
- Do not use a separate .BAS module for startup or shutdown.
- Never use more that once instance of the VBSQL.VBX in any one project.
If any of these rules are violated, it may case a general protect fault (GP
fault) in your Visual Basic application.
NOTE: Even though there should never be more that once instance of the
VBSQL.VBX in any one project, it is OK to have more that one application
running at a time on the same workstation using the VBSQL.VBX; as long as
there is one VBSQL.VBX per project. It is not possible to share Database
Processes (DBPROCs) between separate executables.
The VBSQL.VBX maps a very large percentage of DB-Lib calls directly to VB
from W3DBLIB.DLL. The VBSQL.VBX takes care of that fact that VB does not
support C declared (CDECL) functions.
Visual Basic for Windows only supports Pascal calls and DB-Library
(W3DBLIB.DLL) exports its functions in C. The VBSQL.VBX make that
transition from Pascal to C. It also automatically handles the allocation
of memory in Visual Basic for results coming back from the SQL Server. In
addition to memory allocation, the VBSQL.VBX also automatically coverts all
data coming back from the SQL Server to the front-end from char, int,
money, etc. to a standard Visual Basic string.
Additional query words:
usage golden how to GPF error message Windows NT
Keywords : kbinterop SSrvVisB SSrvWinNT
Version : 4.2 4.21
Platform : WINDOWS
Issue type :
Last Reviewed: March 20, 1999