다음을 통해 공유


CDynamicParameterAccessor::SetParam

Sets the parameter buffer using the specified (non-string) data.

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( );

Parameters

  • ctype
    A templated parameter that is the data type.

  • nParam
    [in] The parameter number (offset from 1). Parameter 0 is reserved for return values. The parameter number is the index of the parameter based on its order in the SQL or stored procedure call. For example:

    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] The parameter name.

  • pData
    [in] The pointer to the memory containing the data to be written to the buffer.

  • status
    [in] The DBSTATUS column status. For information on DBSTATUS values, see Status in the OLE DB Programmer's Reference, or search for DBSTATUS in oledb.h.

Return Value

Returns true on success or false on failure.

Use SetParam to set nonstring parameter data in the buffer. Use SetParamString to set string parameter data in the buffer.

Requirements

Header: atldbcli.h

See Also

Concepts

CDynamicParameterAccessor Class

CDynamicParameterAccessor Members