Board index » delphi » EDatabase Error "unassigned code" - URGENT

EDatabase Error "unassigned code" - URGENT

When I try to exec a SQL I received the message EDatabaseError "unassigned
code".
The code is:

procedure TFormCupomF1.SQLAddItem;
var SQL   : TSQLQuery;
begin
  SQL := TSQLQuery.Create(nil);
  With SQL do
  try
    SQLConnection := MyConnection; {MyConnection is open}
    NoMetadata    := True;

    SQL.Add('Insert into ITEMCUPOM( Maquina, Item, Cupom, Produto,
Quantidade, Unitario, Total, TaxaICMS, Cancelado, DataEmissao, Desconto )');
    SQL.Add('values( :nMaquina, :nItem, :nCupom, :nProduto, :nQuantidade,
:nUnitario, :nTotal, :nTaxaICMS, :nCancelado, :nDataEmissao, :nDesconto )');

    ParambyName('nMaquina').AsSmallInt := 1;
    ParambyName('nItem').AsSmallInt := 1;
    ParambyName('nCupom').AsInteger  := 10;
    ParambyName('nProduto').AsString   := 'Teste';
    ParambyName('nQuantidade').AsFloat    := 1;
    ParambyName('nUnitario').AsFloat    := 1;
    ParambyName('nTotal').AsFloat    := 1;
    ParambyName('nTaxaICMS').AsFloat    := 17;
    ParambyName('nCancelado').AsSmallInt := 0;
    ParambyName('nDataEmissao').AsDateTime := Now;
    ParambyName('nDesconto').AsFloat    := 0;

    Prepared := True;
    ExecSQL; {here, on ExecSQL the message is raised}
  finally
    Free;
  end;
end;

What can It be ?

Daniel Dummer

 

Re:EDatabase Error "unassigned code" - URGENT


Quote
"Daniel Dummer" <dan...@cvsoft.com.br> wrote in message

news:3c3b4edc_1@dnews...

Quote
> When I try to exec a SQL I received the message EDatabaseError "unassigned
> code".
> The code is:

> procedure TFormCupomF1.SQLAddItem;

>     SQL.Add('Insert into ITEMCUPOM( Maquina, Item, Cupom, Produto,
> Quantidade, Unitario, Total, TaxaICMS, Cancelado, DataEmissao,
Desconto )');
>     SQL.Add('values( :nMaquina, :nItem, :nCupom, :nProduto, :nQuantidade,
> :nUnitario, :nTotal, :nTaxaICMS, :nCancelado, :nDataEmissao,
:nDesconto )');

>     ParambyName('nMaquina').AsSmallInt := 1;
>     ParambyName('nItem').AsSmallInt := 1;
>     ParambyName('nCupom').AsInteger  := 10;
>     ParambyName('nProduto').AsString   := 'Teste';
>     ParambyName('nQuantidade').AsFloat    := 1;
>     ParambyName('nUnitario').AsFloat    := 1;
>     ParambyName('nTotal').AsFloat    := 1;
>     ParambyName('nTaxaICMS').AsFloat    := 17;
>     ParambyName('nCancelado').AsSmallInt := 0;
>     ParambyName('nDataEmissao').AsDateTime := Now;
>     ParambyName('nDesconto').AsFloat    := 0;

>     Prepared := True;
>     ExecSQL; {here, on ExecSQL the message is raised}

Try calling Prepare after setting the SQL text and before setting the
parameters.

--
Wayne Niddery (Logic Fundamentals, Inc.)
Learning Interbase? See
http://www.logicfundamentals.com/interbasecourseoutline.html
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html

Other Threads