Saves the contents of the current record, and any changes you've made to it, to an updatable Recordset object.
Syntax
VOIDUpdate(short sType = dbUpdateRegular,
VARIANT_BOOL bForce = FALSE);
Parameters
Type | Example | Description |
SHORT | sType = dbUpdateRegular | Optional. A constant indicating the type of update, as specified in Settings (ODBCDirect workspaces only). |
VARIANT_BOOL | bForce = FALSE | Optional. A Boolean value indicating whether or not to force the changes into the database, regardless of whether the underlying data has been changed by another user since the AddNew, Delete, or Edit call. If TRUE, the changes are forced and changes made by other users are simply overwritten. If FALSE (default), changes made by another user while the update is pending will cause the update to fail for those changes that are in conflict. No error occurs, but the BatchCollisionCount and BatchCollisions properties will indicate the number of conflicts and the rows affected by conflicts, respectively (ODBCDirect workspaces only). |
Settings
You can use the following values for the first argument. You can use the non-default values only if batch updating is enabled.
Constant | Description |
dbUpdateRegular | (Default) Pending changes aren’t cached and are written to disk immediately. |
dbUpdateBatch | All pending changes in the update cache are written to disk. |
dbUpdateCurrentRecord | Only the current record’s pending changes are written to disk. |
Usage
#include <afxole.h>
#include <dbdao.h>
COleVariant vVal(_T("LastName"), VT_BSTRT);
CdbRecordset rst;
... // Intialize recordset etc.
rst.Edit();
rst.SetField( 0L, vVal); // Edit the first field.
rst.Update(dbUpdateCurrentRecord, TRUE);