Before you can use SQL commands, you need to connect to the SQL database system. The SQLConnect function provides this access. You need to call this function before any other SQL functions. It has the format:
SQLConnect(sConnect);
where sConnect
is
the connection string, for example:
INT hSQL;
hSQL = SQLConnect("DSN=DBASE_FILES;DB=C:\ODBC\EMP;LCK=NONE;CS=ANSI");
! Connect to a dBASE Compatible Database File.
INT hSQL;
hSQL = SQLConnect("DSN=EXCEL_FILE;DB=C:\ODBC\EMP;FS=10");
! Connect to an Excel File.
INT hSQL;
hSQL = SQLConnect("DSN=ORACLE_TABLES;SRVR=X:ACCTS;UID=SCOTT;PWD=TIGER");
! Connect to an Oracle Database.
Refer to the documentation that accompanied your SQL server for details about connecting to an SQL database.
See Also