I think it's as simple as using Query1.RecordCount.
If you're only interested in the count then maybe run a different SQL in your TQuery - something like 'SELECT COUNT(Field1) RecordCount FROM Table1' and then read the value of Query1RecordCount.AsInteger.
Either way should work - the second will probably be more efficient if it is ONLY the count you are interested in.
Hope that this helps.
Steve
Nope, in interbase not all records are fetched after opening a query too, so RecordCount would give a wrong result. StevenK a call to Last method fetches all records into memory, a call to First returns cursor to the first record as if you've just opened the query (you can call to FetchAll instead of Last/First).
Correct me if i am wrong. Cheers.
I've run a simple 'SELECT * FROM Table1' command and done a RecordCount against the TQuery and it gives me the required answer.
I had no need for First or Last calls - although maybe that is the safer way of doing things with this ?
If I'm doing things wrong then it's wiser I start to do them right ....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.