{
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);
beginif (ClientDataSet1.ChangeCount > 0) then
ClientDataSet1.ApplyUpdates(-1);
end;