virtual void SetParamValue( int nIndex, const COleVariant& var );
throw( CDaoException, CMemoryException );
virtual void SetParamValue( LPCTSTR lpszName, const COleVariant& var );
throw( CDaoException, CMemoryException );
Parameters
nIndex
The numerical position of the parameter in the querydef’s Parameters collection.
var
The value to set; see Remarks.
lpszName
The name of the parameter whose value you want to set.
Remarks
Call this member function to set the value of a parameter in the recordset at run time. The parameter must already have been established as part of the recordset’s SQL string. You can access the parameter either by name or by its index position in the collection.
Specify the value to set as a COleVariant object. For information about setting the desired value and type in your COleVariant object, see class COleVariant. Note that if you are not creating a UNICODE recordset, the COleVariant object must be explicitly declared ANSI. This can be done by using the COleVariant::COleVariant( lpszSrc, vtSrc ) form of constructor with vtSrc set to VT_BSTRT (ANSI) or by using the COleVariant function SetString( lpszSrc, vtSrc ) with vtSrc set to VT_BSTRT.
For more information about updating data, see the article DAO Recordset: Recordset Operations in Visual C++ Programmer's Guide. For related information, see the topic "Parameter Object" in DAO Help.
CDaoRecordset Overview | Class Members | Hierarchy Chart
See Also CDaoRecordset::GetParamValue, CDaoRecordset::m_nParams, CDaoRecordset::SetParamValueNull