SQLConnect() function
- Last UpdatedJun 17, 2024
- 1 minute read
You use the SQLConnect() function in an InTouch QuickScript to connect to the database specified by the ConnectString argument.
SQLConnect() returns a value to the ConnectionID argument that is used as a parameter in all subsequent SQL functions. You must have a Bind List defined in the application folder before using the SQLConnect function in a script.
Category
SQL
Syntax
[ResultCode=]SQLConnect(ConnectionID, "ConnectString");
Arguments
ConnectionID
Name of a memory integer tag that holds the number (ID) assigned by the SQLConnect() function to each database connection.
ConnectString
String that identifies the database and any additional logon information used in SQLConnect() function.
Remarks
You must have a Bind List (a SQL.DEF file) in the application folder. This function does not work without it.
If SQLTrace=1 is defined under the [InTouch] section of the win.ini file, each successful execution of SQLConnect logs version information for the ADO, the provider, and the database system to the Log Viewer.
Examples
The following statements connects to IBM OS/2 Database Manager and to the database named SAMPLE:
[ResultCode=]SQLConnect(ConnectionID,"DSN=OS2DM;
DB=SAMPLE");
This function returns a value to the ConnectionID variable that is used as a parameter in all subsequent SQL Functions.
"DSN=data source name[;attribute=value
[;attribute=value]...]"