Click or drag to resize

SqlDisconnect Function

X#
Terminates a connection to a data source.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION SqlDisconnect(
	nStatementHandle AS LONG
) AS LONG
Request Example View Source

Parameters

nStatementHandle
Type: Long
Specifies the statement handle to the data source returned by SqlConnect( ).
Specify 0 for nStatementHandle to terminate all active connections.

Return Value

Type: Long
Numeric. 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.
Remarks
SqlDisconnect( ) terminates a connection to a data source. You must supply the statement handle that SqlConnect( ) returned when you established the connection.
If you execute SqlDisconnect( ) within an asynchronous function sequence or during a transaction, SqlDisconnect( ) generates an error.
Examples
X#
1STORE SqlConnect('MyFoxSQLNT', '<userid>', '<password>') TO gnHandle
2IF gnHandle <= 0
3= MessageBox('Cannot make connection', 16, 'SQL Connect Error')
4ELSE
5= MessageBox('Connection made', 48, 'SQL Connect Message)
6= SqlDisconnect(gnHandle)
7ENDIF
See Also