SQLConnect - cSQLHandleManager
Creates a connection and returns the handle to the connection.
Type: Function
Return Data Type: Integer
Parameters
| Parameter | Type | Description |
|---|---|---|
| sDrvrID | String | Driver IdCan be:ConstantMeaning |
| sConnect | String | Connection string |
Syntax
Function SQLConnect String sDrvrID String sConnect Returns Integer
Call Example
Get SQLConnect sDrvrID sConnect to IntegerVariable
Description
The SQLConnect function creates a connection; it returns the Handle to the connection. If the connection cannot be established, 0 (zero) will be returned.
The driver and connection string to use must be passed as parameter to the function. Alternatively, you can pass two empty strings, which will use the defaults established through the SQLSetConnect message. The defaults are only used if both parameters are empty strings!
Sample
This sample uses one cSQLHandleManager object to connect through DB2 Connectivity Kit and through the SQL Server Connectivity Kit.
Handle hoSQLMngr
Handle hdbcSQL hDBCDB2
Object oSQLHandler Is A cSQLHandleManager
Move Self To hoSQLMngr
End_Object
Send SQLSetConnect of hoSQLMngr "MSSQLDRV"
Get SQLConnect of hoSQLMngr "" "" to hDBCSQL
Get SQLConnect of hoSQLMngr "DB2_DRV" "DSN=MyServer" To hDBCDB2
See Also
Return Value
Returns the handle to the connection.