Subject | RE: [IBO] Stored Procedure Changed Params not used!! |
---|---|
Author | Helen Borrie |
Post date | 2003-10-01T01:13:25Z |
At 10:32 AM 1/10/2003 +1000, you wrote:
solved by your code because of a simple error in the sequence of your handler:
procedure TForm1.Button1Click(Sender: TObject);
begin
IBOStoredProc1.Unprepare;
IBOStoredProc1.Prepare; // possibly could be omitted altogether, see below
IBOStoredProc1.ParamByName('ByAmount').AsInteger :=
StrToIntDef(Edit1.Text, 0);
// IBOStoredProc1.Prepare; <-- wrong place
// The call to IBOStoredProc *should* prepare the statement before
// performing the ParamByName() method. However, IMO, it doesn't
// hurt with SPs to call Prepare yourself - either way, the Prepare must
// _precede_ the assignment of values to parameters.
IBOStoredProc1.ExecProc;
Memo1.Lines.Add('ByAmount = ' +
IBOStoredProc1.ParamByName('ByAmount').AsString +
', GenResult = ' + IBOStoredProc1.ParamByName('GenResult').AsString);
end;
Helen
>Here's more info on the problem,To answer your problem as briefly and neutrally as possible:
>I created a simple test scenerio and was able to reproduce the problem (well,
>unfortunately I can't produce anyother result at the moment, lol :oP)
>We are using:This is simply the IB 5.x/IB 6 XSQLDA bug rearing its head and not being
> - Interbase Server 5.6
> - Interbase Client 5.6.0.29
solved by your code because of a simple error in the sequence of your handler:
procedure TForm1.Button1Click(Sender: TObject);
begin
IBOStoredProc1.Unprepare;
IBOStoredProc1.Prepare; // possibly could be omitted altogether, see below
IBOStoredProc1.ParamByName('ByAmount').AsInteger :=
StrToIntDef(Edit1.Text, 0);
// IBOStoredProc1.Prepare; <-- wrong place
// The call to IBOStoredProc *should* prepare the statement before
// performing the ParamByName() method. However, IMO, it doesn't
// hurt with SPs to call Prepare yourself - either way, the Prepare must
// _precede_ the assignment of values to parameters.
IBOStoredProc1.ExecProc;
Memo1.Lines.Add('ByAmount = ' +
IBOStoredProc1.ParamByName('ByAmount').AsString +
', GenResult = ' + IBOStoredProc1.ParamByName('GenResult').AsString);
end;
Helen