[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'db' (#fcl)

# TDataSet.EOF

Indicates whether the last record has been reached.

## Declaration

Source position: db.pas line 1341

`public property TDataSet.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 TDataset.Last method is called.
2. The record is on the last record, and the TDataset.Next method is called.
3. The dataset is empty when opened

In all other cases, EOF is False. Note that when the cursor is on the last-but-one record, and Next is called, EOF will not yet be True. It is only when the cursor is on the last record and Next is called, that EOF will 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

TDataset.BOF |  | Is the cursor at the beginning of the data (on the first record)
TDataset.Next |  | Go to the next record in the dataset.
TDataset.Last |  | Navigate forward to the last record
TDataset.IsEmpty |  | Check if the dataset contains no data

The latest version of this document can be found at lazarus-ccr.sourceforge.net .