OLE DB Programmer's Reference

IErrorLookup::GetErrorDescription

Returns the error message and source, based on the return code and the provider-specific error number.

HRESULT GetErrorDescription (
   HRESULT        hrError,
   DWORD          dwLookupID,
   DISPPARAMS    *pdispparams,
   LCID           lcid,
   BSTR          *pbstrSource,
   BSTR          *pbstrDescription);

Parameters

hrError
[in]
The code returned by the method that caused the error.
dwLookupID
[in]
The provider-specific number of the error.
pdispparams
[in]
The parameters of the error. If there are no error parameters, this is a null pointer.
lcid
[in]
The locale ID for which to return the description and source.
pbstrSource
[out]
A pointer to memory in which to return a pointer to the name of the component that generated the error. If an error occurs, *pbstrSource is set to a null pointer. The memory for this string is allocated by the provider and must be freed by the consumer with a call to SysFreeString.
pbstrDescription
[out]
A pointer to memory in which to return a pointer to a string that describes the error. If pdispparams was not a null pointer, the error parameters are integrated into this description. If there is no error description or an error occurs, the returned value (*pbstrDescription) is a null pointer. The memory for this string is allocated by the provider and must be freed by the consumer with a call to SysFreeString.

Return Code

S_OK
The method succeeded.
E_FAIL
A provider-specific error occurred.
E_INVALIDARG
pbstrSource or pbstrDescription was a null pointer.
E_OUTOFMEMORY
The provider was unable to allocate sufficient memory in which to return the error source or description.
DB_E_BADHRESULT
hrError was invalid.
DB_E_BADLOOKUPID
dwLookupID was invalid.
DB_E_NOLOCALE
The locale ID specified in lcid was not supported by the provider.

See Also

IErrorInfo::GetDescription | IErrorLookup::GetHelpInfo