SQLError function (CLI) - Retrieve error information
In ODBC 3.0, SQLError() has
been deprecated and replaced with SQLGetDiagRec() and SQLGetDiagField(). Although
this version of CLI continues
to support SQLError(), use SQLGetDiagRec() in
your CLI programs
so that they conform to the latest standards.
Note:
Unicode equivalent: This
function can also be used with the Unicode character set. The corresponding
Unicode function is SQLErrorW(). See Unicode functions (CLI) for information about ANSI to Unicode
function mappings.
Migrating to the new function
To read the error diagnostic records for a statement handle,
the
SQLError()
function,
SQLError(henv, hdbc, hstmt, *szSqlState, *pfNativeError,
*szErrorMsg, cbErrorMsgMax, *pcbErrorMsg);
for
example, would be rewritten using the new function as: SQLGetDiagRec(SQL_HANDLE_HSTMT, hstmt, 1, szSqlState, pfNativeError,
szErrorMsg, cbErrorMsgMax, pcbErrorMsg);