dbConnect

Top  Previous  Next

Syntax

POINTER = dbConnect(driver as STRING,filename as STRING,options as STRING,OPT parwnd as POINTER)

Description

Connects to a database directly by specifying a driver name and options.

Parameters

driver - Name of database driver to use for connection.

filename - Filename for database

options - Parameters for connection

parwnd - Optional. EBASIC WINDOW type as the parent for error dialogs.

Return value

A pointer to the connected database or NULL if the connection could not be established.

Remarks

The names of all ODBC drivers on the system can be obtained by the dbEnumDrivers function.  Not all drivers are file based and the filename parameter can be left as an empty string "".  The options are driver dependent.

A successful connection must be established before any SQL statements can be executed. Before the application exits it needs to disconnect from the driver using dbDisconnect

See Also: dbEnumDrivers, dbConnectDSN, dbDisconnect

Example usage

pdb = dbConnect("Microsoft Access Driver (*.mdb)",GETSTARTPATH + "db1.mdb","UID=admin;PWD=zzyyz")