Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Terminates a connection to a data source.
SQLDISCONNECT(nConnectionHandle)
Return Values
Numeric
Parameters
- nConnectionHandle
Specifies the connection handle to the data source returned by SQLCONNECT( ). Specify 0 for nConnectionHandle to terminate all active connections.
Remarks
SQLDISCONNECT( ) returns 1 if the connection is successfully terminated, – 1 if there is a connection level error, and – 2 if there is an environment level error.
SQLDISCONNECT( ) terminates a connection to a data source. You must supply the connection handle that SQLCONNECT( ) returned when you established the connection.
Note If you execute SQLDISCONNECT( ) within an asynchronous function sequence or during a transaction, SQLDISCONNECT( ) generates an error.
Example
The following example assumes an ODBC data source called MyFoxSQLNT is available. SQLCONNECT( ) is issued, and its return value is stored to a variable named gnConnHandle.
If you successfully connect to the data source, SQLCONNECT( ) returns a positive number, a dialog is displayed and SQLDISCONNECT( ) is used to disconnect from the data source.
If you cannot connect to the data source, SQLCONNECT( ) returns a negative number and a message is displayed.
STORE SQLCONNECT('MyFoxSQLNT', '<userid>', '<password>') TO gnConnHandle
IF gnConnHandle <= 0
= MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
ELSE
= MESSAGEBOX('Connection made', 48, 'SQL Connect Message)
= SQLDISCONNECT(gnConnHandle)
ENDIF