TDataSetCancel (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following fragment prompts you to confirm changes to a record; if you click Yes, the record is posted to the table, otherwise the changes are cancelled.

Code

procedure TForm1.Button2Click(Sender: TObject);
begin
if MessageDlg('Update Record?', mtConfirmation, [mbYes, mbNo], 0) =
              mrYes then
  Table1.Post
else
  Table1.Cancel; 
end;

Uses