I'm trying to use SQLBindParameter
to prepare my driver for input via SQLPutData
. The field in the database is a TEXT
field. My function is crafted based on MS's example here:
http://msdn.microsoft.com/en-us/library/ms713824(VS.85).aspx.
I've setup the environment, made the connection, and prepared my statement successfully but when I call SQLBindParam
(using code below) it consistently fails reporting: [Microsoft][SQL Native Client]Invalid precision value
int col_num = 1;
SQLINTEGER length = very_long_string.length( );
retcode = SQLBindParameter( StatementHandle,
col_num,
SQL_PARAM_INPUT,
SQL_C_BINARY,
SQL_LONGVARBINARY,
NULL,
NULL,
(SQLPOINTER) col_num,
NULL,
&length );
The above relies on the driver in use returning "N" for the SQL_NEED_LONG_DATA_LEN
information type in SQLGetInfo
. My driver returns "Y". How do I bind so that I can use SQLPutData
?