CRecordset::SetFieldDirty
Flags a field data member of the recordset as changed or as unchanged.
void SetFieldDirty(
void* pv,
BOOL bDirty = TRUE
);
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
Marking fields as unchanged ensures the field is not updated and results in less SQL traffic.
참고
This member function is not applicable on recordsets that are using bulk row fetching. If you have implemented bulk row fetching, then SetFieldDirty will result in a failed assertion. For more information about bulk row fetching, see the article Recordset: Fetching Records in Bulk (ODBC).
The framework marks changed field data members to ensure they will be written to the record on the data source by the record field exchange (RFX) 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.
Using NULL for the first argument of the function will apply the function only to outputColumn fields, not param fields. For instance, the call
SetFieldNull(NULL);
will set only outputColumn fields to NULL; param fields will be unaffected.
To work on param fields, you must supply the actual address of the individual param you want to work on, such as:
SetFieldNull(&m_strParam);
This means you cannot set all param fields to NULL, as you can with outputColumn fields.
Requirements
Header: afxdb.h