共用方式為


CDaoQueryDef::SetParamValue

Call this member function to set the value of a parameter in the querydef at run time.

virtual void SetParamValue( 
   LPCTSTR lpszName, 
   const COleVariant& varValue  
);
virtual void SetParamValue( 
   int nIndex, 
   const COleVariant& varValue  
);

Parameters

  • lpszName
    The name of the parameter whose value you want to set.

  • varValue
    The value to set; see Remarks.

  • nIndex
    The ordinal position of the parameter in the querydef's Parameters collection. You can obtain this value with calls to GetParameterCount and GetParameterInfo.

Remarks

The parameter must already have been established as part of the querydef's SQL string. You can access the parameter either by name or by its ordinal 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.

Requirements

Header: afxdao.h

See Also

Concepts

CDaoQueryDef Class

CDaoQueryDef Members

Hierarchy Chart

CDaoQueryDef::GetParamValue