Главная страница | назад





Article #10319: TIBQuery.RecordCount doesn't return count of all records

Question:
When I execute TIBQuery.RecordCount why doesn't it give me a count of all my records in my Query?

Answer:
TIBQuery.RecordCount does the same thing as TIBSQL.RecordCount. Here is what Help says for TIBSQL.RecordCount:

Use the RecordCount property to see how many records are returned by a query. If the result set is to return 100 rows, RecordCount will only be 100 after all the records have been visited. That is, after looking at the first record, RecordCount is 1, and so forth.

The reason RecordCount operates in this fashion is calculating all the records in a dataset is potentially time consuming operation as it would require scanning through the entire dataset. The most efficient way to calculate the number of records in a dataset is to execute a SELECT COUNT(*) statement.

Last Modified: 18-OCT-99