Initializing DB-Library for Visual Basic

The first task of a DB-Library for Visual Basic application is to call the SqlInit$ function to initialize DB-Library for Visual Basic. During initialization, your application becomes "registered" with DB-Library, preventing conflicts with other applications that might call this library at the same time.

Your application must call SqlInit$ before it calls any other DB-Library for Visual Basic function. Because no other DB-Library for Visual Basic actions can take place before the call to SqlInit$, call SqlInit$ at the start of your application (usually the Form_Load event procedure of the application's primary, or startup, form).

SqlInit$ takes no parameters and returns the DB-Library version number as a string (where DB-Library is the generic name for the standard SQL Server client interface on which DB-Library for Visual Basic is based). Your error handlers should be available when SqlInit$ is called.

The following program fragment illustrates a valid call to SqlInit$:

'Initialize DB-Library for Visual Basic Library.
IF SqlInit$() = "" THEN
   PRINT "DB-Library for Visual Basic Library has not been initialized."
   END
END IF

For an example of how SqlInit$ is used, refer to the QUERY sample application. This sample application satisfies the initialization requirement by calling the routine InitializeApplication, which in turn calls SqlInit$. InitializeApplication is defined separately in the INIEXITW.BAS common code module.