Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TDBAdvGrid
Slow loading date into TDBAdvGrid

Some dataset implementations have a slow MoveBy operation that causes in turn that TDBAdvGrid is slow. A solution for this is to use a SQL 'SELECT COUNT' operation to supply the number of rows in the dataset to TDBAdvGrid via the event OnGetRecordCount.

In this code snippet, OnGetRecordCount is implemented as:
procedure TForm1.DBAdvGrid1GetRecordCount(Sender: TObject; var Count: Integer); 
begin 
  Query2.SQL.Text := 'select Count(*) from Country.db'; 
  Query2.Active := True; Count := Query2.Fields[0].AsInteger; 
  Query2.Active := False; 
end;
This is also explained in the TDBAdvGrid PDF developers guide, page 6.