Subject Re: [IBO] TIB_DSQL Parameter error message
Author Helen Borrie
At 07:59 AM 4/10/2004 -0700, you wrote:

>Greetings,
>I've recently just started using TIB_DSQL for retrieving a product
>description (thanks to Helen, I wasn't aware you could retrieve field values
>with this low-overhead component).
>
>The code to get the product description is this:
>
> If qryGetProdDesc.Active then
> qryGetProdDesc.Active := False;
>
> If NOT qryGetProdDesc.Prepared then
> qryGetProdDesc.Prepare;
>
> qryGetProdDesc.ParamByName('ProdID').AsString := Field.AsString;
> qryGetProdDesc.Active := True;
> ProdDesc := qryGetProdDesc.FieldByName('ProdDesc').AsString;
>
> If qryGetProdDesc.Active then
> qryGetProdDesc.Active := False;
>
> If qryGetProdDesc.Prepared then // <--- had to add this
> qryGetProdDesc.Unprepare; // <--- to avoid below
>error
>
>
>I had to add the last test and unprepare the TIB_DSQL otherwise I get:
>
> ISC Error Code: 335544569
> Dynamic SQL Error
> SQL Error code = -804
> SQLDA missing or incorrect version, or incorrect number/type of variables.
>
>Is there a way to update the parameters and reactivate w/out unprepare and
>re-prepare?

Well.

TIB_DSQL is only for EXECUTING statements, so if you have a SELECT
statement as its SQL then that's your problem. You *can* use it to retrieve
field variables by executing an executable procedure that has return
values; and you read them from the Fields[] array after execution. If
your statement is an UPDATE, INSERT or DELETE statement then these
statements don't return any parameters.

Could you start by providing the SQL.

Helen