AddHostVariable()


" "

short AddHostVariable(long QueryID, short Type, const VARIANT& Value)

Description

This function applies the data in Value to a variable in the static SQL statement initialized with QueryID. Call this function for each variable in the statement. QMF for Windows makes no attempt to match values to variables, so you should call this function in the same order as the variables in the SQL statement.

Parameters


Name Description
QueryID The ID of the query, as returned from InitializeStaticQuery().
Type

The SQL data type of the value to be passed to the database server. This value influences the conversion of Value from a VARIANT data type to the value actually passed. The valid values for Type include:

384 (RSDT_DATE) -- Date
388 (RSDT_TIME) -- Time
392 (RSDT_TIMESTAMP) -- Timestamp
448 (RSDT_VARCHAR) -- Variable length character string
452 (RSDT_CHAR) -- Character string
464 (RSDT_VARGRAPHIC) -- Variable length graphic
468 (RSDT_GRAPHIC) -- Graphic
480 (RSDT_FLOAT) -- Floating point number
496 (RSDT_INTEGER) -- 4-byte integer
500 (RSDT_SMALLINT) -- 2-byte integer

Value The data value to substitute in the statement. To specify a null value, set the variant type to VT_EMPTY.

Return Value

The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString() or GetLastErrorType() to get additional error information.