[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'BufDataset' (#fcl)

# TCustomBufDataset.ApplyUpdates

Applies pending updates to the dataset

## Declaration

Source position: bufdataset.pas line 631

`public procedure TCustomBufDataset.ApplyUpdates; virtual; overload; procedure TCustomBufDataset.ApplyUpdates(`
`MaxErrors: Integer`
`); virtual; overload;`

## Arguments

`MaxErrors` |  | Maximum number of errors allowed before cancelling the operation

## Description

ApplyUpdates is an overloaded procedure used to apply pending updates for the dataset.

ApplyUpdates calls CheckBrowseMode and gets a bookmark for the current record in the dataset. The bookmark is used to return the dataset its original record after updates are applied and the dataset has been refreshed.

MaxErrors is the threshold where errors encountered in the process cause it to be aborted. The value 0 (zero) indicates no errors are allowed during the apply updates process.

ApplyUpdates uses the internal update buffers allocated for the dataset to perform the actions required in the method. The ApplyRecUpdate method is called for each of the update buffers. An exception raised in ApplyRecUpdate is handled in the method. When the value in MaxErrors is exceeded, the process is aborted. Otherwise, the update buffer is skipped. If the OnUpdateError exception handler has been assigned, it is signalled using the required arguments and its Response value is captured in the method. If the process is to be aborted, an exception is raised to indicate the condition.

When an update buffer is successfully applied, resources allocated to its OldValuesBuffer, Bookmark data, and the update buffer itself are freed. If all pending updates are applied successfully, and ManualMergeChangeLog contains False, the MergeChangeLog method is called.

ApplyUpdates calls Resync to fresh the records displayed in the dataset prior to exiting from the method.

## See also

TDataset.CheckBrowseMode |  | Check whether the dataset is in browse mode.
TRecUpdateBuffer |  | Implements a buffer used for record updates in TBufDataset
TCustomBufDataset.OnUpdateError |  | Event handler signalled when an error occurs while updating records
TCustomBufDataset.ManualMergeChangeLog |  | Indicates if the update change log can be manually merged
TCustomBufDataset.MergeChangeLog |  | Frees update buffers and Blob update buffer allocated for the dataset
TDataset.Resync |  | Resynchronize the data buffer