Subject Re: [IBO] Passing input arguments with TIB_Query
Author yaedos2000
Hi, I've tried that, but I keep getting an error message when I try
to prepare the query, saying that IN_TID is an unknown column. Is
there anything else I should be doing?

Thanks

--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 12:18 PM 13/01/2005 +0000, you wrote:
>
>
> >Hi,
> >
> >I'm using a stored procedure as follows which takes one input
> >variable and returns two output variables:
> >
> >CREATE PROCEDURE SP_SELECT_ID(
> > IN_TID INTEGER)
> >RETURNS (
> > OUT_ID INTEGER,
> > OUT_TID INTEGER)
> >AS
> >begin
> > FOR SELECT ID, TID FROM TABLE_1 WHERE TID = :IN_TID
> >INTO :OUT_ID, :OUT_TID DO
> > suspend;
> >end
> >^
> >
> >I'm using a TIB_Query statement to select the required data:
> >
> >SELECT OUT_ID, OUT_TID FROM SP_SELECT_ID(IN_TID);
> >
> >How do you get the TIB_Query component to pass in the input
variable?
> >I'm currently using:
> >
> >tid := 5;
> >id := query(tid).FieldByName('OUT_ID').AsString;
> >
> >but this isn't working, presumably due to incorrect syntax
somewhere.
> >What is the correct method of passing an input variable into this
> >procedure?
>
> You must first ensure that the query is prepared:
>
> if not YourQuery.Prepared then
> YourQuery.Prepare;
>
> Then, either
>
> YourQuery.ParamByName('IN_TID').AsInteger := tid;
>
> or
>
> YourQuery.Params[0].AsInteger := tid;
>
> Helen
>
>
>
>
>
>
>
>
>
>_____________________________________________________________________
______
> >IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> > without the need for BDE, ODBC or any other layer.
>
>_____________________________________________________________________
______
> >http://www.ibobjects.com - your IBO community resource for Tech
Info papers,
> >keyword-searchable FAQ, community code contributions and more !
> >Yahoo! Groups Links
> >
> >
> >
> >