void SetFieldDirty( void* pv, BOOL bDirty = TRUE );
throw( CDaoException, CMemoryException );
Parameters
pv
Contains the address of a field data member in the recordset or NULL. If NULL, all field data members in the recordset are flagged. (C++ NULL is not the same as Null in database terminology, which means “having no value.”)
bDirty
TRUE if the field data member is to be flagged as “dirty” (changed). Otherwise FALSE if the field data member is to be flagged as “clean” (unchanged).
Remarks
Call this member function to flag a field data member of the recordset as changed or as unchanged. Marking fields as unchanged ensures the field is not updated.
The framework marks changed field data members to ensure they will be written to the record on the data source by the DAO record field exchange (DFX) mechanism. Changing the value of a field generally sets the field dirty automatically, so you will seldom need to call SetFieldDirty yourself, but you might sometimes want to ensure that columns will be explicitly updated or inserted regardless of what value is in the field data member. The DFX mechanism also employs the use of PSEUDO NULL. For more information, see CDaoFieldExchange::m_nOperation.
If the double-buffering mechanism is not being used, then changing the value of the field does not automatically set the field as dirty. In this case, it will be necessary to explicity set the field as dirty. The flag contained in m_bCheckCacheForDirtyFields controls this automatic field checking.
Important Call this member function only after you have called Edit or AddNew.
Using NULL for the first argument of the function will apply the function to all outputColumns, not params in CDaoFieldExchange. For instance, the call
SetFieldDirty( NULL );
will set only outputColumns to NULL. The value of param will be unaffected.
To work on a param, you must supply the actual address of the individual param you want to work on, such as:
SetFieldDirty( &m_strParam );
This means you cannot set all params NULL, as you can with outputColumns.
SetFieldDirty is implemented through DoFieldExchange.
For more information about record field exchange, see the articles DAO Record Field Exchange (DFX) and DAO Recordset: Binding Records Dynamically in Visual C++ Programmer's Guide.
CDaoRecordset Overview | Class Members | Hierarchy Chart
See Also CDaoRecordset::SetFieldNull, CDaoRecordset::SetFieldValue