Requests cancellation of an executing SQL statement.
SQLCANCEL(В ) cancels the execution of SQLCOLUMNS(В ), SQLEXEC(В ), SQLMORERESULTS(В ), and SQLTABLES(В ) in asynchronous mode. To establish asynchronous mode, use the SQLSETPROP(В ) function.
SQLCANCEL(nStatementHandle) |
Parameters
- nStatementHandle
- Specifies the active statement handle whose SQL statement is to be canceled.
Return Value
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.
Example
The following example assumes SQLCONNECT(В ) is successfully issued, and its return value is stored to a memory variable named gnHandle
.
SQLEXEC(В ) is used to sends a SQL statement to the data source and return the results to a cursor. SQLCANCEL(В ) is issued to stop the query.
В | Copy Code |
---|---|
= SQLSETPROP(gnHandle, 'asynchronous', .T.) && To stop SQLEXEC( ) = SQLEXEC(gnHandle, 'SELECT * FROM authors') = SQLCANCEL(gnHandle) && Wrong select statement, cancel |