SQLError--Retrieve error information

In ODBC Version 3, SQLError() was deprecated and replaced with SQLGetDiagRec() and SQLGetDiagField(); see SQLGetDiagRec--Get multiple fields settings of diagnostic record for more information.

Recommendation: Although this version of DB2 CLI continues to support SQLError(), use SQLGetDiagRec() in your DB2 CLI programs so that they conform to the latest standards.

Migrating to the new function

For example, to get diagnostic information associated with a particular statement handle, the statement:

SQLError(henv, hdbc, hstmt, szSqlState, pfNativeError, szErrorMsg,
    cbErrorMsgMax, pcbErrorMsg);
 

would be rewritten using the new function as:

SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, 1, szSqlState, pfNativeError,
    szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
 

Související odkazy