RAD Studio VCL Reference
|
Sends all updated, inserted, and deleted records from the client dataset to the provider for writing to the database.
function ApplyUpdates(MaxErrors: Integer): Integer; virtual;
virtual __fastcall int ApplyUpdates(int MaxErrors);
Call ApplyUpdates to write all updated, inserted, and deleted records from the client dataset to the database or source dataset. MaxErrors indicates the maximum number of errors that the provider should allow before prematurely stopping the update operation. Set MaxErrors to –1 to indicate that there is no limit to the number of errors.
ApplyUpdates
1.Generates a BeforeApplyUpdates event. (This event may not be public on some TCustomClientDataSet descendants.)
2.Calls the provider to apply the updates in the Delta property and receives any records returned by the provider because they generated errors when it attempted to apply them to the database.
3.Generates an AfterApplyUpdates event. (This event may not be public on some TCustomClientDataSet descendants.)
4.Calls the client dataset's Reconcile method to reconcile any records that are returned in step 2.
Delphi Examples:
{ This BeforeDisconnect event handler makes sure that the client dataset has applied all its pending updates before terminating the connection to the server. } procedure TForm1.RemoteServer1BeforeDisconnect(Sender: TObject); begin if (ClientDataSet1.ChangeCount > 0) then ClientDataSet1.ApplyUpdates(-1); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|