Sign in Join
FPDoc Onlineexperiment

TDataSet.EOF property

Member of TDataSetpublicIn unit DB

Indicates whether the last record has been reached.

Declaration

pascal
property EOF: Boolean read FEOF;

Description

EOF is True if the cursor is on the last record in the dataset, and no more records are available. It is also True for an empty dataset. The EOF property will be set to True in the following cases:

  1. The cursor is on the last record, and the Next method is called.
  2. The Last method is called (which is equivalent to moving to the last record and calling Next).
  3. The dataset is empty when opened.

In all other cases, EOF is False. Note: when the cursor is on the last-but-one record, and Next is called (moving the cursor to the last record), EOF will not yet be True. Only if both the cursor is on the last record andNext is called, will EOF become True.

This means that the following loop will stop after the last record was visited:

With MyDataset do
  While not EOF do
    begin
    DoSomething;
    Next;
    end;

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.