this is run ok


invoke SQLBindParameter,hstmt,2,SQL_PARAM_INPUT,SQL_C_CHAR, SQL_CHAR,48,0,addr [esi].redname,0,0
]

but



invoke SQLBindParameter,hstmt,2,SQL_PARAM_INPUT,SQL_C_CHAR, SQL_CHAR,48,0,addr [esi].redname,0,SQL_NTS
]

can not run,

when i read the msdn


StrLen_or_IndPtr Argument
The StrLen_or_IndPtr argument points to a buffer that, when SQLExecute or SQLExecDirect is called, contains one of the following. (This argument sets the SQL_DESC_OCTET_LENGTH_PTR and SQL_DESC_INDICATOR_PTR record fields of the application parameter pointers.)

The length of the parameter value stored in *ParameterValuePtr. This is ignored except for character or binary C data.
SQL_NTS. The parameter value is a null-terminated string.
SQL_NULL_DATA. The parameter value is NULL.
SQL_DEFAULT_PARAM. A procedure is to use the default value of a parameter, rather than a value retrieved from the application. This value is valid only in a procedure called in ODBC canonical syntax, and then only if the InputOutputType argument is SQL_PARAM_INPUT or SQL_PARAM_INPUT_OUTPUT. When *StrLen_or_IndPtr is SQL_DEFAULT_PARAM, the ValueType, ParameterType, ColumnSize, DecimalDigits, BufferLength, and ParameterValuePtr arguments are ignored for input parameters and are used only to define the output parameter value for input/output parameters.
The result of the SQL_LEN_DATA_AT_EXEC(length) macro. The data for the parameter will be sent with SQLPutData. If the ParameterType argument is SQL_LONGVARBINARY, SQL_LONGVARCHAR, or a long, data source?specific data type, and the driver returns "Y" for the SQL_NEED_LONG_DATA_LEN information type in SQLGetInfo, length is the number of bytes of data to be sent for the parameter; otherwise, length must be a nonnegative value and is ignored. For more information, see "Passing Parameter Values," later in this section.
For example, to specify that 10,000 bytes of data will be sent with SQLPutData for an SQL_LONGVARCHAR parameter, an application sets *StrLen_or_IndPtr to SQL_LEN_DATA_AT_EXEC(10000).

SQL_DATA_AT_EXEC. The data for the parameter will be sent with SQLPutData. This value is used by ODBC 1.0 applications when calling ODBC 3.x drivers. For more information, see "Passing Parameter Values," later in this section.
If StrLen_or_IndPtr is a null pointer, the driver assumes that all input parameter values are non-NULL and that character and binary data are null-terminated. If InputOutputType is SQL_PARAM_OUTPUT and ParameterValuePtr and StrLen_or_IndPtr are both null pointers, the driver discards the output value.

Note Application developers are strongly discouraged from specifying a null pointer for StrLen_or_IndPtr when the data type of the parameter is SQL_C_BINARY. To ensure that a driver does not unexpectedly truncate SQL_C_BINARY data, StrLen_or_IndPtr should contain a pointer to a valid length value.
If the InputOutputType argument is SQL_PARAM_INPUT_OUTPUT or SQL_PARAM_OUTPUT, StrLen_or_IndPtr points to a buffer in which the driver returns SQL_NULL_DATA, the number of bytes available to return in *ParameterValuePtr (excluding the null-termination byte of character data), or SQL_NO_TOTAL (if the number of bytes available to return cannot be determined). If the procedure returns one or more result sets, the *StrLen_or_IndPtr buffer is not guaranteed to be set until all results have been fetched.

If the value in the SQL_ATTR_PARAMSET_SIZE statement attribute is greater than 1, StrLen_or_IndPtr points to an array of SQLINTEGER values. These can be any of the values listed earlier in this section and are processed with a single SQL statement.


who can explain what problem
Posted on 2005-02-05 08:43:28 by jndk
I think you simply should pass the last parameter as a pointer, not directly:
mov dwString, SQL_NTS

lea eax, dwString
invoke SQLBindParameter,hstmt,2,SQL_PARAM_INPUT,SQL_C_CHAR, SQL_CHAR,48,0,addr [esi].redname,0,eax
Posted on 2005-02-09 06:43:39 by beaster
but



invoke SQLBindParameter,hstmt,2,SQL_PARAM_INPUT,SQL_C_CHAR, SQL_CHAR,48,0,addr [esi].redname,0,0


can work very ok

so if as you say
i think if eax just = SQL_NTS
will can not work !!!

why? :?:
Posted on 2005-02-10 20:24:31 by jndk
the docu says:
Syntax

SQLRETURN SQLBindParameter(
SQLHSTMT StatementHandle,
SQLUSMALLINT ParameterNumber,
SQLSMALLINT InputOutputType,
SQLSMALLINT ValueType,
SQLSMALLINT ParameterType,
SQLUINTEGER ColumnSize,
SQLSMALLINT DecimalDigits,
SQLPOINTER ParameterValuePtr,
SQLINTEGER BufferLength,
SQLINTEGER * StrLen_or_IndPtr);
and for the last parameter
If StrLen_or_IndPtr is a null pointer, the driver assumes that all input parameter values are non-NULL and that character and binary data are null-terminated. If InputOutputType is SQL_PARAM_OUTPUT and ParameterValuePtr and StrLen_or_IndPtr are both null pointers, the driver discards the output value.
so you can either push 0 or a pointer to the len / type - not type directly. And 0 means the default case - NTS, and will work.
Posted on 2005-02-11 04:45:27 by beaster
thanks
Posted on 2005-02-13 02:48:23 by jndk