Skip to content

TDataSet.Insert

Insert a new record at the current position.

Declaration

Source position: db.pas line 1927

public 
procedure TDataSet.Insert;

Description

Insert will insert a new record at the current position. When this function is called, any pending modifications (when the dataset already is in insert or edit mode) will be posted. After that, the BeforeInsert, BeforeScroll, OnNewRecord, AfterInsert and AfterScroll events are triggered in the order indicated here. The dataset is in the dsInsert state after this method is called, and the contents of the various fields can be set. To write the new record to the underlying database TDataset.Post must be called.

Errors

If the dataset is read-only, calling Insert will result in an EDatabaseError.

See also

Name Description
BeforeInsert Event triggered before the dataset is put in insert mode.
BeforeScroll Event triggered before the cursor changes position.
OnNewRecord Event triggered when a new record is created.
AfterInsert Event triggered after the dataset is put in insert mode.
AfterScroll Event triggered after the cursor has changed position.
TDataset.Post Post pending edits to the database.
TDataset.Append Append a new record to the data.