Error Handling
When a specific method invocation against an OLE DB provider returns an error code, SQL Server looks for the provider’s extended error information before returning information about the error condition to the user.
SQL Server uses the OLE DB error object as specified by OLE DB. Some of the high-level steps are:
- When a method invocation returns an error code from the provider, SQL Server looks for the ISupportErrorInfo interface. If this interface is supported, SQL Server calls ISupportErrorInfo::InterfaceSupportsErrorInfo to verify whether error objects are supported by the interface that produced the error code.
- If error objects are supported by the interface, SQL Server calls the GetErrorInfo function to get an IErrorInfo interface pointer on the current error object.
- SQL Server uses the IErrorInfo interface to get a pointer to the IErrorRecords interface.
- SQL Server uses IErrorRecords to loop through all the error records in the object and get the error message text corresponding to each record.
For more information about how the provider’s error object is used, see your OLE DB documentation.