CDaoQueryDef::SetParamValue

void SetParamValue( LPCTSTR lpszName, const COleVariant& varValue );
throw( CDaoException, CMemoryException );

void SetParamValue( int nOrdinal, const COleVariant& varValue );
throw( CDaoException, CMemoryException );

Parameters

lpszName

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

varValue

The value to set; see Remarks.

nOrdinal

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

Remarks

Call this member function to set the value of a parameter in the querydef at run time. 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.

For examples and more information about parameterizing queries, see the article DAO Queries: Filtering and Parameterizing Queries in Visual C++ Programmer's Guide. For related information, see the topic "PARAMETERS Declaration (SQL)" in DAO Help.

CDaoQueryDef OverviewClass MembersHierarchy Chart

See Also   CDaoQueryDef::GetParamValue