Subject Error with parameters
Author Andrei Luís
Hello,

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?
- What can I do to solve this without opening the query before feed
the parameters?
- This is the best syntax? (First open the query and then feed the
parameters) If so, I will do this from now on.

[]s
Andrei