Cancels execution of a pending asynchronous method call (ODBCDirect workspaces only).
Syntax
VOIDCancel(VOID);
Remarks
Use the Cancel method to terminate execution of an asynchronous Execute or OpenConnection method call (that is, the method was invoked with the dbRunAsync option).
Usage
#include <afxole.h>
#include <dbdao.h>
CdbDBEngine dben(...,dbUseODBC);
CdbWorkspace wrkMain;
CdbConnect conMain;
wrkMain = dben.CreateWorkspace("ODBCWorkspace",
_T("admin"), _T(""), dbUseODBC);
// Open the connection asynchronously.
conMain = wrkMain.OpenConnection("Publishers",
(dbDriverNoPrompt | dbRunAsync),
FALSE,
_T("ODBC;DATABASE=pubs;UID=sa;PWD=;DSN=Publishers"));
// Wait a few seconds...
// If the connection has not been made, quit.
if (conMain.StillExecuting())
conMain.Cancel();
else
{ // Use the Connection object conMain.
...
conMain.Close();
}
wrkMain.Close();