Version: 7.0.0

SQLBindParameter ​

Function ​

Binds a parameter marker in an SQL statement to a buffer.

Prototype ​

c
SQLRETURN SQLBindParameter(SQLHSTMT       StatementHandle,    
                           SQLUSMALLINT   ParameterNumber,     
                           SQLSMALLINT    InputOutputType,
                           SQLSMALLINT    ValueType,
                           SQLSMALLINT    ParameterType,
                           SQLULEN        ColumnSize,
                           SQLSMALLINT    DecimalDigits,
                           SQLPOINTER     ParameterValuePtr,
                           SQLLEN         BufferLength,
                           SQLLEN         *StrLen_or_IndPtr);

Parameters ​

Table 1 SQLBindParameter parameters

Keyword

Description

StatementHandle

Statement handle.

ParameterNumber

Parameter number, starting from 1 and incrementing sequentially.

InputOutputType

Input/Output parameter type.

ValueType

C data type of the parameter.

ParameterType

SQL data type of the parameter.

ColumnSize

Size of the column or the expression of the corresponding parameter marker.

DecimalDigits

Decimal digits of the column or the expression of the corresponding parameter marker.

ParameterValuePtr

Pointer to the buffer that stores the parameter data.

BufferLength

Length of the buffer pointed to by ParameterValuePtr, in bytes.

StrLen_or_IndPtr

Length or indicator pointer of the buffer. If it is NULL, no length or indicator value is used.

Return Values ​

  • SQL_SUCCESS: The call is successful.

  • SQL_SUCCESS_WITH_INFO: Some warning information is present.

  • SQL_ERROR: The parameter failed to be bound.

  • SQL_INVALID_HANDLE: The input handle is invalid.

Example ​

See: Example