| Previous | Next |
| DB_E_BADSTARTPOSITION | DB_E_NOTREENTRANT |
DB_E_NOQUERY
Meaning
Windows documents DB_E_NOQUERY as “Information was requested for a query and the query was not set”. Here, an OLE DB query-information or command-tree operation is requested before a query has been assigned to the object.
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 object identity and query-state transition history.
- Evidence 2: which query or command-setting interface was used.
- Evidence 3: the exact metadata or translation method that required an existing query.
Specific conditions that produce it
- Cause 1: the query setter was never called.
- Cause 2: the query was cleared during object reuse.
- Cause 3: the caller has command text but is invoking a separate query-tree contract that was not initialized.
Retry and recovery policy
Retry rule: retry after assigning the query expected by the invoked contract.
Corrective actions
- Action 1: set the query through the interface required by that object.
- Action 2: keep text-command and command-tree initialization paths distinct.
- Action 3: assert query state before requesting plan, text or metadata information.
Practical incident
A component sets SQL text on one command wrapper but asks an uninitialized command-tree object for query metadata; initializing the correct object removes it.
Difference from related HRESULT values
DB_E_NOCOMMAND reports missing command text on a command object, while DB_E_NOQUERY reports missing query state for a query-specific operation.
Official Microsoft references
Looking for a different code? Search another status or error code.