From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function ApplyUpdates(AMaxErrors: Integer = -1): Integer;


int __fastcall ApplyUpdates(int AMaxErrors = 0xffffffff);


Type Visibility Source Unit Parent
function public
FireDAC.Comp.DataSet TFDDataSet


Applies changes for all records in the dataset change log to the database.

Use ApplyUpdates to apply changes for all records in the dataset change journal to the database.  This method is useful when CachedUpdates is True. The ApplyUpdates call performs the following steps:

AMaxErrors indicates the maximum number of errors that FireDAC should allow before prematurely stopping the update operation. Set AMaxErrors to –1 to indicate that there is no limit to the number of errors or to 0 to indicate that no error is allowed.

ApplyUpdates returns the number of errors it encountered. Based on this return value and the setting of AMaxErrors, successfully applied records are removed from the change log of the dataset. If the update process is aborted before all updates are applied, any unapplied updates remain in the change log. 

ApplyUpdates does not raise exceptions. Instead, the application should review erroneous records using Reconcile and the OnReconcileError event handler or FilterChanges and the RowError properties. For more details, read "Reviewing errors" at Caching Updates

All changes are applied in the dataset modifications order. First modification (insert / update / delete) is applied first, last modification is applied last.


procedure TForm1.btnApplyClick(ASender: TObject);
  if FDStoredProc1.UpdatesPending then

See Also