Errors (OLE DB)

This section addresses the ability of OLE DB to process errors by using methods that either return a code or create an error object. Error objects can return detailed error information. Handling of multiple error items is discussed Arrays of Errors, later in this section.

The mechanics of how an Automation component returns and/or retrieves an error object, as well as its use of threads, is presented here. OLE DB extends Automation error objects by adding the ability for an error object to contain multiple error records. Provider-specific error lookup services are also discussed.

For more information on

Go to

Return codes

Return Codes (OLE DB)

Arrays of errors

Arrays of Errors

How an Automation component returns an error object

How an Automation Component Returns an Error Object

How an Automation consumer retrieves an error object

How an Automation Consumer Retrieves an Error Object

OLE DB error objects

OLE DB Error Objects

Error object example

Error Object Example

Error records

Error Records

Error record example

Error Record Example

Interfaces used by OLE DB error objects

Interfaces Used by OLE DB Error Objects

How a provider returns an error object

How a Provider Returns an OLE DB Error Object

How a consumer retrieves an error object

How a Consumer Retrieves an OLE DB Error Object

Use of threads

OLE DB Error Objects and Threads

Threading and Error Objects

Provider-specific error lookup services

Error Lookup Services

Error Lookup Service Registry Entries

Methods return error information in two ways. The value returned by a method indicates the overall success or failure of the method. Error objects provide detailed information about the error, such as text describing the error, the Help file containing information about the error, a text description of the program that was the source of the error, and any provider-specific error information. Error objects in OLE DB are an extension of the error objects in Automation, use many of the same mechanisms, and can be used as Automation error objects.

The error object, custom error object, and error record object cotypes are defined as follows. For more information about cotypes, see Conceptual Programming Models in OLE DB.

CoType TErrorObject {
   [mandatory]   interface IErrorRecords;

CoType TCustomErrorObject {
   [optional]   interface ISQLErrorInfo

CoType TErrorRecord {
   [mandatory]   interface IErrorInfo;