SQLSetParam function (CLI) - Bind a parameter marker to a buffer or LOB locator
In ODBC 2.0 and later, SQLSetParam() is
deprecated and replaced with SQLBindParameter(). Although
this version of CLI continues
to support SQLSetParam(), use SQLBindParameter() in
your CLI programs
so that they conform to the latest standards.
Migrating to the new function
The CLI function SQLBindParameter() is
functionally the same as the SQLSetParam() function.
Both take a similar number and type of arguments, behave the same,
and return the same return codes. The difference is that SQLSetParam()
does
not have the InputOutputType or BufferLength arguments
to specify the parameter type and maximum buffer length. Calling SQLSetParam()
is
functionally equivalent to calling SQLBindParameter()
with
the InputOutputType argument set to SQL_PARAM_INPUT
and the BufferLength argument set to SQL_SETPARAM_VALUE_MAX.
The statement:
SQLSetParam(hstmt, 1, SQL_C_SHORT, SQL_SMALLINT, 0, 0,
¶meter1, NULL);
for example, would
be rewritten using the new function as: SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SHORT,
SQL_SMALLINT, 0, 0, ¶meter1,
SQL_SETPARAM_VALUE_MAX, NULL);