skip to main content
Developing ODBC Applications : Threading : Cancelling Functions in Multithreaded Applications
 

Cancelling Functions in Multithreaded Applications

In a multithreaded application, the application can cancel a function that is running synchronously on a statement. To cancel the function, the application calls SQLCancel with the same statement handle as that used by the target function, but on a different thread. Whether SQLCancel actually cancels the running function depends on the data store being accessed.
The ODBC driver allows canceling when used with:
An IP that uses the OpenAccess SQL engine.
An IP that integrates a third-party SQL engine that supports canceling.
SQLCancel always returns SQL_SUCCESS. If SQLCancel has been called from a different thread while there is a pending request, the original statement will return SQL_ERROR with the error message Operation cancelled.