Skip to content

TDataSetEnumerator

Enumerator for TDataset records.

Declaration

Source position: db.pas line 1998

type

  TDataSetEnumerator = class
  public
    constructor Create;
    function MoveNext : Boolean;
    property Current: TFields; {r}
  end;

Description

TDataSetEnumerator is an enumerator for the records in a dataset. It returns the TDataset.Fields instance. It navigates from the first till the last record in the dataset. The following is an example of how this can be used, in conjunction with the field enumerator:

var
  Rec : TFields;
  Fld : TField;

begin
  for Rec in MyDataset do
    for F in Rec do
      Writeln(F.Name,' : ',F.AsString);

Note that the current record pointer of the dataset is modified as the loop is traversed. If the current record is modified by other code while the loop is running, the result may become unpredictable. Similarly, if 2 enumerators are used simultaneously for the same dataset, the results are unpredictable.

Properties

Member Visibility Description
Current read only public Current record.

Methods

Member Visibility Description
Create public Create a new instance of the dataset enumerator.
MoveNext public Attempts to navigate to the next record.

See also

Name Description
TDataset Base class for records-based data-access.
TFields Collection of #fcl.db.TField instances.
TFieldsEnumerator Default enumerator for the fields collection of a dataset.