| Previous | Next |
| DB_E_BADCOLUMNID | DB_E_BADVALUES |
DB_E_BADRATIO
Meaning
Windows documents DB_E_BADRATIO as “Numerator was greater than denominator. Values must express ratio between zero and 1”. Here, a ratio-based positioning operation receives a numerator greater than its denominator.
Relevant OLE DB contract
This result must be interpreted against this contract: OLE DB rowsets own HROW values, fetch position, granted properties and visibility rules; row handles, bookmarks, update state and navigation capabilities remain valid only under the lifetime and generation that produced them.
Diagnostic sequence
- Capture this result immediately at the native OLE DB return and obtain the current OLE DB error object before another COM call replaces thread error information.
- Identify the exact stage: a ratio-based positioning operation receives a numerator greater than its denominator.
Specific conditions that produce it
- Cause 1: the caller reverses numerator and denominator.
- Cause 2: integer conversion or sign handling corrupts one ratio component.
- Cause 3: a percentage calculation produces a value outside the inclusive zero-to-one interval.
Evidence to collect before changing the system
When it involves row values, bookmarks, keys and query parameters, record types, lengths, hashes or redacted identifiers instead of secrets or full business data.
- Evidence 1: the raw numerator and denominator before conversion.
- Evidence 2: the rowset method and requested fetch count.
- Evidence 3: the calculation path that derived the ratio.
Corrective actions
- Action 1: validate denominator and range before the OLE DB call.
- Action 2: use checked arithmetic when converting percentages or progress values.
- Action 3: define boundary behavior explicitly for zero and one.
Retry and recovery policy
Retry rule: retry after correcting the ratio; rowset state does not repair an invalid fraction.
Difference from related HRESULT values
DB_E_BADSTARTPOSITION concerns an offset outside the rowset, while DB_E_BADRATIO concerns an invalid fractional position request.
Practical incident
A scrollbar converts 80 percent to numerator 100 and denominator 80 by swapping fields; correcting the mapping eliminates it.
Official Microsoft references
Looking for a different code? Search another status or error code.
