Establishes a connection to a data source.
Syntax
SQLCONNECT([DataSourceName, cUserID, cPassword | cConnectionName])
Returns
Numeric
Arguments
DataSourceName
Specifies the name of a data source as defined in your Odbc.ini file.
cUserID
Specifies a user identifier used to log on to the data source.
cPassword
Specifies the password to the data source.
cConnectionName
Specifies a named connection created with CREATE CONNECTION.
Remarks
SQLCONNECT( ) returns a positive non-zero numeric handle if you successfully connect to the data source. You should store this handle in a memory variable and use the variable in subsequent function calls that require a connection handle. SQLCONNECT( ) returns – 2 if the connection cannot be made.
If SQLCONNECT( ) is issued without any of its additional arguments, the Select Connection or Data Source dialog box can be displayed, allowing you to choose a data source.
Note The ODBC login dialog must be disabled to support SQL pass through with Microsoft Transaction Server. Use SQLSETPROP(cConnectionHandle, 'DispLogin', 3) to disable the ODBC login dialog (cConnectionHandle is the connection handle returned by SQLCONNECT). The ODBC login dialog can also be disabled in the Connection Designer.