Subject Re: [IBO] TIB_Cursor not returning correct result
Author sgharp
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 03:24 PM 25/08/2004 +0000, you wrote:
> >Hi All,
> >
> >I have a strange problem that's got me stumped. I'm executing a
> >stored procedure that populates some fields in a table. Next, I'm
> >using a TIB_Cursor to query a numeric field in the table. The
query
> >is returning a zero which is incorrect.
> >
> >Now the kinky part. I can stop the debugger (breakpoint) as soon
as
> >the query returns the zero and cut and paste the SQL statement
into
> >IBExpert and execute it. The query executed in IBExpert returns
> >14.09 which is correct.
> >
> >The stored procedure mentioned above empties the table and then
> >populates it with calculated values. It works fine and generates
> >the numbers correctly. I don't understand why the TIB_Cursor
would
> >return a different result than IBExpert with exactly the same
query
> >at the same point in time.
>
> You aren't meant to call Open on TIB_Cursor, since nothing will
arrive
> until the first Fetch is called. Open is a method of the dataset
> buffer. TIB_Cursor doesn't have one.
>
> Always call First to "open" a TIB_Cursor. Then it will shout down
the wire
> at the SP "send me what you're holding for me over there." While
the TIB_C
> is busy doing its thing with that row, the SP will resume
executing and
> generate another row.
>
> The same holds for TIB_C's over real datasets. Call First to get
a row,
> then call Next to get another one.

Thanks Helen but that didn't do it. I changed the code to

qry.Open;
qry.First;

and it still returns zero. Do you have any other ideas? BTW, I use
TIB_Cursor in several places and haven't ever seen anything like
this.

Steve