SQLCANCEL( ) Function

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.

= SQLSETPROP(gnHandle, 'asynchronous', .T.)   && To stop SQLEXEC( )
= SQLEXEC(gnHandle, 'SELECT * FROM authors')
= SQLCANCEL(gnHandle)   && Wrong select statement, cancel

See Also

Reference

AERROR( ) Function

SQLCOLUMNS( ) Function

SQLEXEC( ) Function

SQLMORERESULTS( ) Function

SQLSETPROP( ) Function

SQLTABLES( ) Function

SQL Commands and Functions

Other Resources

Language Reference (Visual FoxPro)