Version: 7.0.0

SQLBindCol ​

Function ​

Binds application data buffers to the columns in the result set.

Syntax ​

c
SQLRETURN SQLBindCol(SQLHSTMT       StatementHandle,    
                     SQLUSMALLINT   ColumnNumber,     
                     SQLSMALLINT    TargetType,
                     SQLPOINTER     TargetValuePtr,
                     SQLLEN         BufferLength,
                     SQLLEN         *StrLen_or_IndPtr);

Parameters ​

Table 1 SQLBindCol parameters

Keyword

Parameter Description

StatementHandle

Statement handle.

ColumnNumber

Number of the result set column to bind. Column numbering starts at 0, with columns counted in ascending order. Column 0 is the bookmark column. If no bookmark column is set, column numbering starts at 1.

TargetType

Identifier of the C data type in the buffer.

TargetValuePtr

Output parameter: Pointer to the data buffer bound to the column. The SQLFetch function returns data in this buffer. If this parameter is a null pointer, StrLen_or_IndPtr is a valid value.

BufferLength

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

StrLen_or_IndPtr

Output parameter: Pointer to the buffer's length or indicator. 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 data buffer failed to be bound.

  • SQL_INVALID_HANDLE: The input handle is invalid.

Example ​

See: Example