ISQLServerErrorInfo::GetErrorInfo (OLE DB)

Returns a pointer to a SQLOLEDB SSERRORINFO structure containing Microsoft® SQL Server™ error detail.

Syntax

HRESULT GetErrorInfo(
SSERRORINFO
**ppSSErrorInfo,
OLECHAR**ppErrorStrings);

Arguments
ppSSErrorInfo [out]
Is a pointer to a pointer to an SSERRORINFO structure. 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 **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. The message is returned through the IErrorInfo::GetDescription method.
pwszServer Name of the SQL Server installation 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 error.
bClass Severity of a SQL Server error.
wLineNumber When applicable, the line of a SQL Server 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.

See Also

RAISERROR


(c) 1988-98 Microsoft Corporation. All Rights Reserved.