Subject Re: [IBO] sorry to bother, I am just a beginner in using IB Objects
Author Helen Borrie
At 02:45 AM 19/06/2005 -0700, you wrote:
>thank you for your answer
>I my procedure looks like this
>CREATE PROCEDURE S_UPD_SVANIPF (
> SCOTIZ INTEGER,
> SAPORT INTEGER,
> CDA VARCHAR (13) CHARACTER SET NONE,
> CCA VARCHAR (13) CHARACTER SET NONE,
> CCC VARCHAR (13) CHARACTER SET NONE,
> CDC VARCHAR (13) CHARACTER SET NONE,
> IDPF INTEGER)
>AS
>begin
> //CODE
>
>end
>ok,
>and the code where i use Ib_StoredProc is:
>
>with Sprocedure do
> begin
> Sprocedure.StoredProcName:='S_UPD_SVANIPF';
> try
>
>Sprocedure.FieldByName('IDPF').AsInteger:=IntegerVal;
>
>Sprocedure.FieldByName('CCC').AsString:=StringVal;
>
>Sprocedure.FieldByName('CDC').AsString:=StringVal;
>
>Sprocedure.FieldByName('CDA').AsString:=StringVal;
>
>Sprocedure.FieldByName('CCA').AsString:=StringVal;
>
>Sprocedure.FieldByName('saport').AsInteger:=IntegerVal;
>
>Sprocedure.FieldByName('scotiz').AsInteger:=IntegerVal;
>Sprocedure.Prepare;
>Sprocedure.ExecProc;
> finally
> end;
>
> end;
>
>So, I still receive that error. "Field IPF is
>missing".
>If I move the line where I am setting IPF value, I
>receive the same error but 4 the next field.
>I don't know where is the bug.

OK, two problems here:

1) The INPUTS to stored procedures are contained in the Params[] array, not
Fields[]. Simply change all your FieldByName to ParamByName. Use Fields[]
(if you need to) to refer to the values RETURNED by the SP.

2) Params can not be referred to if the statement is not prepared. So
change your Prepare line to

if not Sprocedure.Prepared then Sprocedure.Prepare;

and place it in your code **before** you assign the values to the Params.

Helen