Is there a problem with cds.RecordCount ?
I usually use it to determine if I have any records in a query.
But talking with a college he told that there is a performance penalty to that!
I have made some test and nothing major came up.
So is there a performance penalty or any other problem with RecordCount?!
If so, what is the best way to check if there are some records in a query?
Thanks
If you're using TClientDataSet (as your 'cds' seems to imply) with PacketRecords
set to -1
(default) or FetchOnDemand
set to False
there is no difference since the client dataset receives and loads all data into memory at once.
The difference would be noticable with other datasets which fetch data on demand as you advance the cursor, using RecordCount
would fetch all data first. In such cases it's better to use the dataset's EOF
property after opening - if all you want to know is whether the result set was empty or not.