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 |
|
Arrays of errors |
|
How an Automation component returns an error object |
|
How an Automation consumer retrieves an error object |
|
OLE DB error objects |
|
Error object example |
|
Error records |
|
Error record example |
|
Interfaces used by OLE DB error objects |
|
How a provider returns an error object |
|
How a consumer retrieves an error object |
|
Use of threads |
|
Provider-specific error lookup services |
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;
}