Siebel VB Language Reference > Siebel VB Language Reference >

SQLClose Function


This custom VB function disconnects from an ODBC data source connection that was established by SQLOpen.

NOTE:  Siebel VB SQLxxxx functions are supported for non-Unicode databases only.

Syntax

SQLClose(connection)

Argument
Description
connection
A named argument that must be a long integer, returned by SQLOpen

Returns

A variant having one of the following values:

Value
Meaning
0
Successful disconnection
-1
Connection is not valid

Usage

For information about named arguments, read Named Arguments and Call Statement.

If you invoke the ODBC function "SQLClose" with an invalid parameter (for example, SQLClose(0) or a variable parameter without an initialized value), the function responds with the undocumented return code of -2, which indicates an invalid data source connection.

CAUTION:  This function, as well as the other SQL functions available in Siebel VB, should not be used to query the underlying database. Use the Siebel Object Interfaces to query Siebel data. Use the SQL functions only to query non-Siebel data.

Example

This example opens the data source named SblTest, gets the names in the ODBC data sources, and closes the connection.

Sub Button_Click
'   Declarations

    Dim outputStr As String
    Dim connection As Long
    Dim prompt As Integer
    Dim datasources(1 To 50) As Variant
    Dim retcode As Variant
         
    prompt = 5
'   Open the data source "SblTest"
    connection = SQLOpen("DSN = SblTest", outputStr, prompt: = 4)

    action1 = 1 ' Get the names of the ODBC data sources
    retcode = SQLGetSchema(connection: = connection,action: _
     = 1,qualifier: = qualifier, ref: = datasources())

'   Close the data source connection
    retcode = SQLClose(connection)
      
End Sub

See Also

SQLError Function
SQLExecQuery Function
SQLGetSchema Function
SQLOpen Function
SQLRequest Function
SQLRetrieve Function
SQLRetrieveToFile Function


 Siebel VB Language Reference
 Published: 18 June 2003