Discussion:
RecordCount and Filtered
(too old to reply)
Simon
2006-09-27 09:41:03 UTC
Permalink
Hello,

I am using ADO in Delphi 5 and Delphi 2006 VCL.NET.
DataBase is Access.

In TADODataSet:
CursorLocation=clUseServer.
CommandType=CmdTableDirect
Filtered=true

In the DataChange-event of the connected TDataSource I want to get the
recordcount:
No:=Table.RecordCount

but it always shows the unfiltered count.
Is that a normal behaviour and how can I get the filtered count?

Thanks+regards

Simon
Bill Todd
2006-09-27 13:41:21 UTC
Permalink
Yes, this is normal behavior. Filter is implemented on the client in
the VCL. To provide the best performance it only scans enough of the
table to find the number of records the client is requesting to fill
the current screen. To know the record count the VCL would have to scan
the entire table and count the records that passed the filter. This
would be very slow on large tables. One way to get an accurate record
count is to use an SQL SELECT to get the records you want.
--
Bill Todd (TeamB)
Loading...