SQL_DISCONNECT action


Function
The action closes the connection (handle) to a database.
Declaration
 SQL_DISCONNECT
handleIdent_Int
Parameters
handleIdent_Intin Identifier of the Int type (handle) - connection to a database (SQL_CONNECT).
Description
Value of handleIdent_Int must be gained by using the action SQL_CONNECT.
Example
Work with a database (actions SQL_...).

 INT  _handle    ; handle to database
 INT  _retCode   ; return code
 TEXT _name      ; product name
 TEXT _type      ; product type
                 ; parametrized SQL command
 TEXT _sql =  "SELECT Name, Type FROM Products WHERE ID>= #PAR# AND ID<= #PAR#" 
 
 SQL_CONNECT MyDatabase, _handle, _retCode
 SQL_PREPARE _handle, _retCode, _sql BINDOUT _name, _type
 SQL_BINDIN  _handle, _retCode, 1, 100 ; read all products between 1 and 100
 
 DO_LOOP
   SQL_FETCH _handle, _retCode
   EXIT_LOOP _retCode #  _ERR_NO_ERROR
   ; data processing goes here
 END_LOOP
 
 SQL_FREE _handle
 SQL_DISCONNECT _handle
 

Related pages:

Napíšte komentár