ADO can return the following specific errors. As a general rule, these errors will never mask an underlying database error. For example, adErrItemNotFound won't be returned from the Fields collection for a missing field if there is an underlying database error.
The errors below have a facility code of "0xA" thus leading to an hresult prefix of "800A".
Constant | Number | Description |
---|---|---|
adErrInvalidArgument | 3001 | You are using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another. |
adErrNoCurrentRecord | 3021 | Either BOF or EOF is True, or the current record has been deleted; the operation you requested requires a current record. |
adErrIllegalOperation | 3219 | The operation you requested is not allowed in this context. |
adErrFeatureNotAvailable | 3251 | The operation you requested is not supported by the provider. |
adErrItemNotFound | 3265 | ADO could not find the object in the collection corresponding to the requested name or ordinal reference. |
adErrObjectNotSet | 3420 | The object reference you are using no longer points to a valid object. |
adErrDataConversion | 3421 | You are using a value of the wrong type for the current operation. |
adErrObjectClosed | 3704 | The operation you requested is not allowed if the object is closed. |
adErrObjectOpen | 3705 | The operation you requested is not allowed if the object is open. |
adErrProviderNotFound | 3706 | ADO could not find the specified provider. |
adErrInvalidParamInfo | 3708 | You have improperly defined a ParameteradobjParameter object. |
adErrInvalidConnection | 3709 | You requested an operation on an object with a reference to a closed or invalid Connection object. |
These ADO errors will not occur: adErrInTransaction, adErrBoundToCommand.
The above errors appear differently from the OLE DB-style errors that the SQL parser / engine produces (which have a facility code of 4) since VB strips off facility codes of A of leaving just the lower 2 bytes of error code displayed to the user.
Errors have an associated error text. The text is stored and retrieved using the IErrorInfo interface. VB uses this to fill its Err object. ADO errors will not provide Helpfile or HelpContext information.