| Previous | Next |
| DB_E_LIMITREJECTED | DB_E_COSTLIMIT |
DB_E_NOCOMMAND
Meaning
Windows documents DB_E_NOCOMMAND as “Command text was not set for the command object”. Here, a command method is called before non-empty command text or an equivalent command definition has been set.
Specific conditions that produce the result
- Cause 1: ICommandText::SetCommandText was never called.
- Cause 2: the command text was cleared by setting an empty string.
- Cause 3: a pooled command object was reset but a later stage assumed its previous text remained.
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 object identity and state transition history.
- Evidence 2: the command dialect GUID and text length, excluding sensitive text from logs.
- Evidence 3: the last SetCommandText result and subsequent reset or reuse events.
Corrective actions
- Action 1: set the command text and dialect before asking for metadata, parameters or execution.
- Action 2: make pooled-command reset state explicit.
- Action 3: fail early when a pipeline reaches execution with an empty command definition.
Practical incident
A pool returns a reset command and the caller binds parameters without setting SQL first; restoring the command setup sequence prevents it.
Retry and recovery policy
Retry rule: retry after setting a non-empty command definition on the same current command object.
Difference from related HRESULT values
DB_E_NOQUERY concerns an unset query in a query-information contract, while DB_E_NOCOMMAND is the general command-object state failure.
Official Microsoft references
Looking for a different code? Search another status or error code.