|
AnyDAC
|
Applies changes for all records in the dataset change log to the database.
|
Parameters |
Description |
|
AMaxErrors: Integer = -1 |
A maximum number of allowed errors. Default value is -1. |
The number of errors is encountered.
Use ApplyUpdates to apply changes for all records in the dataset change journal to the database.
This method is useful when CachedUpdates = True mode. The ApplyUpdates call performs the steps:
AMaxErrors indicates the maximum number of errors that the AnyDAC 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 dataset's change log. If the update process is aborted before all updates are applied, any unapplied updates remain in the change log.
ApplyUpdates does not raise exception. Instead application should review erroneous records using Reconcile and OnReconcileError event handler, or FilterChanges and RowError properties. Read "Reviewing errors" at Caching Updates for more details.
All changes are applied in the dataset modifications order. First modification (insert / update / delete) will be applied first, last modification will be applied last.
function ApplyUpdates(AMaxErrors: Integer = -1): Integer;
procedure TForm1.btnApplyClick(ASender: TObject); begin if ADStoredProc1.UpdatesPending then ADStoredProc1.ApplyUpdates; end;
See AnyDAC\Samples\Comp Layer\TADMemTable\CachedUpdates sample for details.
|
What do you think about this topic? Send feedback!
|