Subject | Re: [IBO] Re: TIB_Cursor not returning correct result |
---|---|
Author | Lucas Franzen |
Post date | 2004-08-26T06:53:20Z |
Steve,
Just assign the Connection and Transaction. That's all you need.
Where do you expect a TIB_Query to be at when opening?
What does the procedure look like?
What happens if you do the same select with an existing TIB_Query (one
that you're not creating on the fly?)
Luc.
> procedure TDMFb.UpdateAveIdealUsage(const sItem : String);what do you assign the database for???
> Var
> iInvItemID : Integer;
> qry : TIB_Query;
> Begin
> iInvItemID := DMFb.GetInvItemID(sItem);
> if (iInvItemID <> 0) then
> Begin
> qry := TIB_Query.Create(Self);
> Try
> qry.IB_Connection := conIx;
> qry.IB_Transaction := trnIx;
> qry.DatabaseName := 'IxFB';
Just assign the Connection and Transaction. That's all you need.
> qry.SQL.Add('Select QtySold From xItemUsages');Add a qry.PREPARE here.
> qry.SQL.Add('Where InvItemID = ' + IntToStr(iInvItemID));
> qry.Open;Remove the qry.FIRST;
> qry.First;
Where do you expect a TIB_Query to be at when opening?
>Is the update just happening here?
> // #todo1 Not Working - Returns 0 for QtySold
> if (not qry.FieldByName('QtySold').IsNull) then
> Begin
> DMFb.spUpdateAveIdealUsage.ParamByName
> ('pInvItemID').AsInteger := iInvItemID;
> DMFb.spUpdateAveIdealUsage.ParamByName
> ('pUsage').AsFloat := qry.FieldByName('QtySold').AsFloat;
> DMFb.spUpdateAveIdealUsage.ExecSQL;
What does the procedure look like?
> End;With exactly the same SQL, not the same query ;-)
> Finally
> qry.Close;
> FreeAndNil(qry);
> End;
> End;
> End;
>
> Note that IBExpert returns the correct value with exactly the same
> query.
What happens if you do the same select with an existing TIB_Query (one
that you're not creating on the fly?)
Luc.