Subject Re: [IBO] Error with parameters
Author Andrei Luís
Hi Jason, thanks for your answer.

To reduce the probabilities, I created a new VM at VirtualBox, with
Win XP SP3, BDS 2006, FB 2.5.1 and IBO 4.9.14 14. The problem persist.

Tried with FB 2.5.0, since this is what I was using a few days ago,
same behavior.

Uninstalled IBO, deleted the bpls at \Windows\System32, and installed
IBO 4.9.9 (the version I think I was using before), and... there it
is! Something happened after version 4.9.9 that is causing this
strange behavior.

By the way, while I was with 4.9.14 version, I added a
qry_tmp.prepare, before the param feed, and then I got no error. But
this is terrible, cause as I said, I have several projects with
several code like this, change everything is completely out of my
plans.

So Jason, I don´t know if my msg put some light to you, I just want to
let u know.


[]s
Andrei



2011/11/5 Support List <supportlist@...>:
> Andrei,
>
>> Today I installed the newest IBO version, and now I'm getting an error
>> in the following code:
>>
>> Procedure CalculaTotal;Var qry_tmp : TIB_Query;Begin  qry_tmp :=
>> TIB_query.Create(Self);  qry_tmp.DatabaseName :=
>> dm.cnSistema.DatabaseName;  qry_tmp.SQL.Text := 'Select
>> Coalesce(sum((qtde  - estorno) *valor), 0) as totPedido, '+
>>                    ' Coalesce(sum((qtde  - estorno) *
>> valor_compra_original), 0) as totCompraPedido, '+
>>          ' Coalesce(sum((qtde  - estorno) * valor_lista), 0) as
>> totPedidoLista '+                               'from pedidosItens
>> where orcamento_id = :worc_id group by orcamento_id';
>> qry_tmp.ParamByName('worc_id').asInteger
>> :=dm.qrOrcamentos.FieldByName('Registro_id').AsInteger;
>> qry_tmp.Open;end;
>> The error is  'Project project1.exe raised exception class
>> EIB_StatementError with message 'Field: worc_id not found'.
>> If I open the query before I feed the parameter, the error doesn´t
>> occur. But this seems that I need to search in all my systems, and
>> change several code lines.
>>
>> - Since which version this behavior was implanted?
>
> I don't yet fully understand why you are having this problem.
>
>
>> - What can I do to solve this without opening the query before feed
>> the parameters?
>
> You should be able to set parameter values prior to opening the query.
>
>
>> - This is the best syntax? (First open the query and then feed the
>> parameters) If so, I will do this from now on.
>
> No, something else is wrong. You should be able to assign values to the
> parameters prior to calling Open. I'm wondering if your installation of the
> new version is having problems due to old compiled code or something else
> making your system unstable.
>
> Jason
>
>
>
> ------------------------------------
>
> ___________________________________________________________________________
> 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
>
>
>
>