|
发表于 2010-8-27 22:53:31
|
显示全部楼层
看起來是為了效率的考量, 我只知要取回正確的 recordcount 值, 要把這個屬性設成 -1
Why does TSQLQuery.RecordCount always return 10?
To count the records in a datase, use '.RecordCount'. However, notice that '.RecordCount' shows the number of records that is already loaded from the server. Sqldb does not read all records when opening TSQLQuery by default, only the first 10. Only when the eleventh record is accessed then the next set of 10 records is loaded. Using '.Last' all records will be loaded.
When you want to know the real number of records on the server you can first call '.Last' and then call '.RecordCount'. An alternative is available. The number of records returned by the server is set by the '.PacketRecords' property. The default value is 10, if you make it -1 then all records will be loaded at once. |
|