Export (0) Print
Expand All

OLE DB Error Message Format

SQL Server 2000

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

  • Call the OLE DB ISQLErrorInfo::GetSQLInfo function.

  • Call the provider-specific ISQLServerErrorInfo::GetErrorInfo function.

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 Microsoft 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 SSERRORINFO structure and a pointer to a string buffer. The pointer to SSERRORINFO structure is NULL when SQL Server does not produce the error.

The SQL Server message parts map to members of the SSERRORINFO structure:


Contains the SQL Server error description.


Contains the SQL Server error number.


Contains the SQL Server error state.


Contains the severity of the SQL Server error condition.


Contains the line number of the stored procedure on which the error occurred.

See Also

Information in OLE DB Error Interfaces

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft