ISQLServerErrorInfo::GetErrorInfo (OLE DB)
Returns a pointer to a SQLOLEDB SSERRORINFO structure containing Microsoft® SQL Server™ 2000 error detail.
Syntax
HRESULT GetErrorInfo(
SSERRORINFO**ppSSErrorInfo,
OLECHAR**ppErrorStrings);
Arguments
ppSSErrorInfo [out]
Is a pointer to an SSERRORINFO structure. If the method fails or there is no SQL Server 2000 information associated with an error, the provider does not allocate any memory, and ensures that **ppSSErrorInfo is a null pointer on output.
ppErrorStrings [out]
Is a pointer to a Unicode character-string pointer. If the method fails or there is no SQL Server information associated with an error, the provider does not allocate any memory, and ensures that **ppErrorStrings is a null pointer on output. Freeing ppErrorStrings with the IMalloc::Free function frees the three individual string members of the returned SSERRORINFO structure, as the memory is allocated in a block.
Return Code Values
S_OK
The method succeeded.
E_INVALIDARG
Either ppSSErrorInfo or ppErrorStrings was NULL.
E_OUTOFMEMORY
SQLOLEDB was unable to allocate sufficient memory to complete the request.
Remarks
SQLOLEDB allocates memory for the SSERRORINFO and OLECHAR strings returned through the pointers passed by the consumer. The consumer must deallocate this memory by using IMalloc::Free when it no longer requires access to the error data.
The SSERRORINFO structure is defined as follows:
typedef struct tagSSErrorInfo
{
LPOLESTR pwszMessage;
LPOLESTR pwszServer;
LPOLESTR pwszProcedure;
LONG lNative;
BYTE bState;
BYTE bClass;
WORD wLineNumber;
}
SSERRORINFO;
Member | Description |
---|---|
pwszMessage | Error message from SQL Server 2000. The message is returned through the IErrorInfo::GetDescription method. |
pwszServer | Name of the instance of SQL Server 2000 on which the error occurred. |
pwszProcedure | Name of the stored procedure generating the error if the error occurred in a stored procedure; otherwise, an empty string. |
lNative | SQL Server error number. The error number is identical to that returned in the plNativeError parameter of the ISQLErrorInfo::GetSQLInfo method. |
bState | State of a SQL Server 2000 error. |
bClass | Severity of a SQL Server 2000 error. |
wLineNumber | When applicable, the line of a SQL Server 2000 stored procedure that generated the error message. The default value if there is no procedure involved is 1. |
Pointers in the structure reference addresses in the string returned in ppErrorStrings.