Show: Delphi C++
Display Preferences

Data.DB.TDataSet.FindFirst

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function FindFirst: Boolean;

C++

bool __fastcall FindFirst();

Properties

Type Visibility Source Unit Parent
function public
Data.DB.pas
Data.DB.hpp
Data.DB TDataSet

Description

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

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

Notes:

Descendant classes override FindFirst to make the first record active, honoring any filters that are in effect. In descendant classes, FindFirst 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

Personal tools
In Other Languages
Previous Versions
Assistance