MDAC 2.5 SDK - ODBC Programmer's Reference
Chapter 15: Diagnostics
The following examples show how various components in an ODBC connection might generate diagnostic messages and how various drivers might return diagnostics to the application with SQLGetDiagRec.