Terminates a connection to an external data source. If this function is not available, you must install the Microsoft ODBC add-in (XLODBC.XLA).
Syntax
SQL.CLOSE(connection_num)
Connection_num is the unique connection ID of the data source from which you wish to disconnect.
Connection_num is returned by a previously executed SQL.OPEN function.
If connection_num is not valid, SQL.CLOSE returns the #VALUE! error value.
Remarks
If the connection is successfully terminated SQL.CLOSE will return zero and the connection ID number is then no longer valid.
If SQL.CLOSE is unable to disconnect with the data source then it will return the error value the #N/A error value. In such a case SQL.CLOSE will place error information in memory for the SQL.ERROR function, if such information is available.
SQL.CLOSE works with data sources in much the same manner as FCLOSE works with files. If the call is successful then SQL.CLOSE will terminate the specified data source connection.
Example
SQL.CLOSE(conn1) will close the connection with connection_num conn1
Related Functions
SQL.OPEN Establishes a connection with a data source
SQL.EXEC.QUERY Sends a query to a data source
SQL.BIND Specifies storage for a result column
SQL.RETRIEVE.TO.FILE Retrieves query results and places them in a file
SQL.RETRIEVE Retrieves query results
SQL.GET.SCHEMA Gets information about a connected data source.
SQL.ERROR Returns detailed error information
Return to index