| Previous | Next |
| DB_E_ERRORSINCOMMAND | DB_E_DIALECTNOTSUPPORTED |
DB_E_CANTCANCEL
Meaning
Windows documents DB_E_CANTCANCEL as “Command cannot be canceled”. Here, ICommand::Cancel or an asynchronous cancellation path cannot cancel the current operation.
Relevant OLE DB contract
This result must be interpreted against this contract: an OLE DB command moves through explicit states: command definition, properties and parameters are established before optional preparation and execution; dialect, query-tree and optimizer contracts are provider-specific and should be inferred only from reported capabilities.
Evidence to collect before changing the system
When it involves command text, parameter values, object names and query-plan details, record types, lengths, hashes or redacted identifiers instead of secrets or full business data.
- Evidence 1: the command identity and execution phase at cancellation time.
- Evidence 2: timestamps for Execute, Cancel and completion.
- Evidence 3: provider capability and any server-side request identifier.
Specific conditions that produce it
- Cause 1: the provider does not support cancellation for this command phase.
- Cause 2: execution already completed before the cancel request arrived.
- Cause 3: the operation is inside a non-interruptible provider or server section.
Retry and recovery policy
Retry rule: retrying Cancel is useful only if the operation remains active and the provider documents repeated cancellation; otherwise wait for the terminal result.
Corrective actions
- Action 1: treat cancellation as best effort and continue observing final completion.
- Action 2: avoid reusing or releasing shared state until the provider reports the final outcome.
- Action 3: use provider-specific cancellation only when officially supported.
Practical incident
A timeout thread calls Cancel after the provider has already finished but before the completion callback is processed; handling the final Execute result avoids misreporting it as a query failure.
Difference from related HRESULT values
DB_E_CANCELED reports that an operation was actually canceled, while DB_E_CANTCANCEL reports that cancellation could not be performed.
Official Microsoft references
Looking for a different code? Search another status or error code.