dbGetErrorCode

Top  Previous  Next

Syntax

STRING = dbGetErrorCode(hstmt as INT)

Description

Returns the ODBC error code for a statement, if any.

Parameters

hstmt - Statement handle created with dbExecSQL or dbPrepareSQL

Return value

A string containing the ODBC error code, or an empty string if no error has occurred.

Remarks

The ODBC error code is a five character string. For human readable text of the error code use dbGetErrorText.

See Also: dbGetErrorText

Example usage

hstmt = dbExecSQL(pdb,"SELECT * FROM Addresses")
error = dbGetErrorCode(hstmt)
IF LEN(error)
    PRINT
    PRINT "Error Code: ", error
    PRINT "Error Text: ", dbGetErrorText(hstmt)
    PRINT
ENDIF