CDynamicParameterAccessor::SetParam

使用指定的 (非字符串) 数据,将参数缓冲区。

template < class ctype >
bool SetParam(
   DBORDINAL nParam,
   const ctype* pData,
   DBSTATUS status = DBSTATUS_S_OK
) throw( );
template < class ctype >
bool SetParam(
   TCHAR* pParamName,
   const ctype* pData,
   DBSTATUS status = DBSTATUS_S_OK
) throw( );

参数

  • ctype
    数据类型是的一个模板参数。

  • nParam
    [] 参数号 (从 1) 的偏移量。 参数 0 保留了对返回值。 参数编号是基于其在 SQL 的顺序的参数的索引或存储过程调用。 例如:

    WCHAR* wszSQL = L"SELECT * FROM Authors WHERE State='?' AND LName='?'";
    
    CCommand<CDynamicParameterAccessor> rs;
    //...
    rs.SetParam<LONG>(1, &m_BillingID);
    rs.SetParam<CString>(2, &m_strFirstName);
    
  • pParamName
    [in] 参数名。

  • pData
    [out] 一个指向包含数据的内存的指针将写入缓冲区。

  • status
    [] DBSTATUS 列状态。 有关 DBSTATUS 值的信息,请参见 OLE DB 程序员参考状态或搜索在 oledb.h 的 DBSTATUS

返回值

返回在成功在失败时进行 truefalse

使用 SetParam 设置缓冲区中的非字符串的参数数据。 使用 SetParamString 设置字符串缓冲区中的参数数据。

要求

Header: atldbcli.h

请参见

参考

CDynamicParameterAccessor 类