OLE DB Error Message Format

OLE DB applications receive Microsoft® SQL Server™ messages in two ways:

ISQLErrorInfo::GetSQLInfo returns the SQL Server error numbers from master.dbo.sysmessages as the plNativeError parameter and the SQLSTATE value as the pbstrSQLState parameter. These SQLSTATE codes are not related to any of the parts of a SQL Server message. The Microsoft OLE DB Provider for SQL Server generates the appropriate SQLSTATE code anytime it returns a message to an application. The SQLSTATE codes generated by the OLE DB Provider for SQL Server are same as the five-character SQLSTATE codes defined in the ODBC specification. For ISQLErrorInfo::GetSQLInfo, pbstrSQLState may be NULL when the error is not produced by SQL Server.

Both the OLE DB Provider for SQL Server and the Microsoft OLE DB Provider for ODBC support the ISQLErrorInfo interface.

The provider-specific ISQLServerErrorInfo interface returns more detail about a SQL Server error. The ISQLServerErrorInfo interface exposes one member function, GetErrorInfo.  The function returns a pointer to a pointer to an SSERRORINFO structure and a pointer to a string buffer. The pointer to pointer to SSERRORINFO structure is NULL when the error is not produced by SQL Server.

The SQL Server message parts map to members of SSERRORINFO structure as described below:

pwszMessage
Contains the SQL Server error description.
lNative
Contains the SQL Server error number.
bState
Contains the SQL Server error state.
bClass
Contains the severity of the SQL Server error condition.
wLineNumber
Contains the line number of the stored procedure on which the error occurred.
See Also

Information in OLE DB Error Interfaces

  


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