Condividi tramite


SQLCANCEL( ) Function

Requests cancellation of an executing SQL statement.

SQLCANCEL(nConnectionHandle)

Return Values

Numeric

Parameters

  • nConnectionHandle
    Specifies the active connection handle whose SQL statement is to be cancelled.

Remarks

SQLCANCEL( ) returns 1 if the SQL statement is successfully cancelled, – 1 if there is a connection level error, and – 2 if there is an environment level error.

SQLCANCEL( ) cancels the execution of SQLCOLUMNS( ), SQLEXEC( ), SQLMORERESULTS( ), and SQLTABLES( ) in asynchronous mode. Use SQLSETPROP( ) to establish asynchronous mode.

Example

The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle.

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(gnConnHandle, 'asynchronous', .T.)  && To stop SQLEXEC( )
= SQLEXEC(gnConnHandle, 'SELECT * FROM authors')
= SQLCANCEL(gnConnHandle)  && Wrong select statement, cancel

See Also

AERROR( ) | SQLCOLUMNS( ) | SQLEXEC( ) | SQLMORERESULTS( ) | SQLSETPROP( ) | SQLTABLES( )