Subject Re: [IBO] RecordCount
Author Lucas Franzen
gerbreown@... schrieb:
>
> 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?

For TIB_Queries:
if qry.IsEmpty then
begin
ShowMessage ('Sorry, we're temporarily out of records...' );
end;

For IB_Cursors:
if cur.EOF then
begin
ShowMessage ( 'No records found...' );
end;

alternatively you could also look for the pk-field:
if qry/cur.FieldByName('MY_PK_FIELD' ).IsNull then
begin
ShowMessage ('Empty!' );
end;

Luc.

>
> TIA,
>
> Gerald S. Brown
>