Subject Re: [IBO] RecordCount
Author Helen Borrie
At 02:24 PM 29-11-00 +0000, you wrote:
>Hi all,
>
>After reading all the posts about the badness of "RecordCount" I
>checked my code and found that I also am using it numerous times. I
>am not using it in a loop though. Basically what my code does is "If
>RecordCount = 0 THEN ShowMessage('There were no records selected for
>this criteria.'), whatever the Query criteria was.
>
>Does anyone know of a better way to accomplish this? Or am I still
>safe in using this methodology?

No! it is definitely only for fileserver systems !

Here's how to do it quick-smart in proper client/server fashion (use a
bdataset for this):

with MyQuery do
begin
if not Prepared then Prepare;
Open;
if IsEmpty then
{ send the message }
;
end;

If it's not a bdataset, do it this way:

with MyCursor do
begin
if not Prepared then Prepare;
Open;
if EOF then
{ send the message }
;
end;

H.

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________