The function is
SQLRETURN SQLBindParameter(
SQLHSTMT StatementHandle,
SQLUSMALLINT ParameterNumber,
SQLSMALLINT InputOutputType,
SQLSMALLINT ValueType,
SQLSMALLINT ParameterType,
SQLULEN ColumnSize,
SQLSMALLINT DecimalDigits,
SQLPOINTER ParameterValuePtr,
SQLLEN BufferLength,
SQLLEN * StrLen_or_IndPtr);
The documentations I have seen is confusing. Do the arguments depend on the data type or not I found an example here http://support.microsoft.com/kb/248799 which does not seem to work on DB2. I thought odbc was consistent across databases. A specific code example would he helpful.
Its not one line as such but
SQLLEN ival;
ret = SQLBindParameter( stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 100, 0, NULL, 0, &ival );
/*
* before execution is called
*/
ival = SQL_NULL_DATA;
That inserts a NULL value as a CHAR(100) datatype. Pick the actual datatype to match what your column type is, but the important thing is to set the indicator value to SQL_NULL_DATA before the SQLExecute or SQLExecDirect is called. And make sure its still set to that value at the execute point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With