Subject | Re: [IBO] How to know if a query is empty with an IB_Cursor |
---|---|
Author | Lucas Franzen |
Post date | 2005-12-28T15:42:51Z |
aosylvain schrieb:
But you should prepare a statement BEFORE setting the parameter.
And check out if you have AutoFetchAll set to True.
And:
IsEmpty *DOES* exist TIB_BDataset (IB_Query!), but NOT in TIB_Cursor
(since this is directly derived from TIB_Dataset).
Luc.
> Hi,No, if a Cursor is Empty then EOF is True *AND* BOF is True.
>
> I'm using a TIB_Cursor to know if a query returns an empty result or not.
>
> I'm doing like this :
>
> With MyCursor do begin
> Close ;
> SQL.Text := 'SELECT ... WHERE ID = :ID' ;
> ParamByName('ID').AsInt64 := id ; // id is a parameter of my function
> Prepare ;
> First ;
> Result := not (EOF and BOF) ;
> end ;
>
> Ok, it works 90% of times. But sometimes, the Result is false but
> should be true.
>
> Am I doing something wrong ?
But you should prepare a statement BEFORE setting the parameter.
And check out if you have AutoFetchAll set to True.
And:
IsEmpty *DOES* exist TIB_BDataset (IB_Query!), but NOT in TIB_Cursor
(since this is directly derived from TIB_Dataset).
Luc.