Click or drag to resize

SqlCancel Function

X#
Requests cancellation of an executing SQL statement.

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

Parameters

nStatementHandle
Type: Long
Specifies the active statement handle whose SQL statement is to be canceled.

Return Value

Type: Long
Numeric. SqlCancel( ) returns 1 if the SQL statement is successfully canceled, – 1 if there is a connection level error, and – 2 if there is an environment level error.
Remarks
SqlCancel( ) cancels the execution of SqlColumns( ), SqlExec( ), SqlMoreResults( ), and SqlTables( ) in asynchronous mode. To establish asynchronous mode, use the SqlSetProp( ) function.
Examples
X#
1= SqlSetProp(gnHandle, 'asynchronous', .T.)   // To stop SqlExec( )
2= SqlExec(gnHandle, 'SELECT * FROM authors')
3= SqlCancel(gnHandle)   // Wrong select statement, cancel
See Also