Data.DB.TDataSet.FindNext

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type: function
Visibility: public
Source:
Data.DB.pas
Data.DB.hpp
Unit: Data.DB
Parent: TDataSet

Delphi

function FindNext: Boolean;

C++

bool __fastcall FindNext();

Description

Implements a virtual method for positioning the dataset on the next record, respecting any filters.

FindNext is intended to be used together with FindFirst, FindLast and FindPrior in order to search for the next record using any filters. See the example.

Notes:

Descendant classes override FindNext to move to the next record of the dataset, honoring any filters that are in effect. In descendants, FindNext returns:

  • True -- if the active record is successfully changed.
  • False -- if the active record is not successfully changed.

Example

Here is a code snippet that shows how to use FindFirst and FindNext to search for a record using a filtering expression:

Delphi:

FDQuery1.Filter := 'amount >= 10000';
if FDQuery1.FindFirst then
   repeat
    // do something
   until not FDQuery1.FindNext;

C++:

FDQuery1->Filter="amount >= 10000";
if (FDQuery1->FindFirst()){
   do {
    // do something
   }
   while (FDQuery1->FindNext());
}

See Also