TDataSetAppend (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example appends a new record to a table or client dataset when you click a button. The two fields, Field1 and Field2, are filled from the contents of two edit controls. This example requires a populated TTable or TDataSet with the appropriate field values.

Code

procedure TForm1.Button1Click(Sender: TObject);
begin
  Customers.Append;
  Customers.FieldValues['Field1'] := StrToInt(Edit1.text);
  Customers.FieldValues['Field2'] := Edit2.text;
  Customers.Post;
end;

Uses