RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDataSet.Append Method

Adds a new, empty record to the end of the dataset.

Pascal
procedure Append;
C++
__fastcall Append();

For datasets that permit editing, call Append to: 

1Open a new, empty record at the end of the dataset. 

2Set the active record to the new record. 

After a call to Append, an application can enable users to enter data in the fields of the record, and can then post those changes to the database or change log using Post (Client datasets can subsequently apply updates in the change log back to the database by calling ApplyUpdates.) A newly appended record is posted to the database in one of three ways:  

For indexed Paradox and dBASE tables, the record is inserted into the dataset in a position based on its index.  

For unindexed Paradox and dBASE tables, the record is added to the end of the dataset.  

For SQL databases, the physical location of the appended record is implementation-specific. For indexed tables, the index is updated with the new record information.  

After the new record is applied back to the database server, its physical location is database-specific. For indexed tables, the index is updated with the new record information.  

Delphi Examples: 

 

{
This example appends a new record to a table or client
dataset when the user clicks 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.
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  Customers.Append;
  Customers.FieldValues['Field1'] := StrToInt(Edit1.text);
  Customers.FieldValues['Field2'] := Edit2.text;
  Customers.Post;
end;

 

AppendRecord 

ApplyUpdates 

Insert 

Post 

CanModify 

Adding New Records 

Posting Data

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!