I am trying to bind an NULL-Value to a parameter in a sql query but I always get an error HY009 Invalid argument value when I execute the statement. That strange behavior only appears when I build in release mode. In debug mode it's working fine. Any ideas?
My Code:
SQLRETURN nRet = SQLPrepare(m_hStmt, (SQLTCHAR *)strSQL, SQL_NTS); // returns SQL_SUCCESS
SQLINTEGER cbNumeric = SQL_NULL_DATA;
nRet = SQLBindParameter(m_hStmt,
parameterIndex,
SQL_PARAM_INPUT,
SQL_C_CHAR,
SQL_LONGVARCHAR,
0,
NULL,
NULL,
0,
&cbNumeric); // returns SQL_SUCCESS
nRet = SQLExecute(m_hStmt); // returns SQL_NEED_DATA
nRet = _SQLParamDataPutData(nRet); // returns Debug: SQL_SUCCESS, Release: SQL_ERROR