Skip to content

SQLBindParamenter函数

功能

绑定执行SQL时需要的参数。

函数原型

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

参数解释

  • StatementHandle:语句句柄。
  • ParameterNumber:参数序号(从1开始)。
  • InputOutputType:参数In/Out类型。
  • ValueType:参数C类型。
  • ParameterType:参数对应的sqltype类型。
  • ColumnSize:参数精度(string类型时参数的长度大小)。
  • DecimalDigits:数值numeric时参数的标度。
  • ParameterValuePtr:参数值指针(引用地址)。
  • BufferLength:参数字节宽度。
  • StrLen_or_IndPtr:参数的实际长度,指针值。

返回值

成功时返回SQL_SUCCESS。