dam_addError
- Last Updated: May 12, 2026
- 1 minute read
- OpenAccess SDK
- Version 8.1
- Documentation
This method adds an error to the error list maintained by the OpenAccess SDK SQL Engine. An error is added at the environment, connection, or statement level. This error string is returned to the client. This is the only way to pass specific error information to the client. An IP method returns an error by adding an error using this method and then returning DAM_FAILURE.
Error messages added using this function are reported with SQL state HY000. Use dam_addErrorEx if you want to specify the SQL state. Use of dam_addError is the recommended approach to report errors to the client.
void dam_addError(
int64 hdbc,
int64 hstmt,
int iErrorIndex,
int iNativeError,
string szErrorText)
Parameters for dam_addError
| Parameter | Type | Description |
| IN | ||
| hdbc | int64 | The connection handle; set to 0 if the error is related to a statement and not to the connection. |
| hstmt | int64 | The statement handle; set to 0 if the error is related to a connection. |
| iErrorIndex | int | Set to DAM_IP_ERROR to indicate an error from the IP. |
| iNativeError | int | Native error as defined by the IP. |
| szErrorText | string | The text to use in place of the standard text. Data from this buffer is copied into the error queue. Set to NULL to use the default error string. Note: The error message is truncated to 2048 characters. |