Server Connectivity Reusable Code: VBODBC

VBODBC is a Visual Basic library that provides an easy method of accessing data from an ODBC data source. It has the following characteristics:

Files

1. VBODBC.BAS Visual Basic module

2. VBODBC1.FRM Visual Basic logon form

3. VBODBC2.FRM Visual Basic query executing form

Function APIs

1. VBODBC_OpenDatabaseDialog() - Establishes an ODBC database connection, prompting the user for connection information.

2. VBODBC_OpenSqlStmt() - Executes a SQL statement.

3. VBODBC_GetNextRow() - Retrieves another row of the SQL statement's result set. The row is retrieved into a variant array parameter, with each element corresponding to the equivalent column number. Element 0 contains all column values separated by tabs.

4. VBODBC_CloseSqlStmt() - Closes the SQL statement.

5. VBODBC_CloseDatabase() - Closes the database connection.

VBODBC Function Flow Chart

Instructions

1. Add VBODBC.BAS, VBODBC1.FRM, VBODBC2.FRM to your project.

2. Verify that you have a proper ODBC data source configured.

3. Follow the function flowchart within your code. Note that only one SQL statement and one database connection can be active at a time, so that you don't have to maintain any handles.

4. Inspect the global structure VBODBC_LastErr if you encounter an error.

5. Inspect the global structure VBODBC_ColDesc for a description of the last SQL statements columns.