StoredProcedure

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Filippe
Posts: 1
Joined: Tue 27 Dec 2016 14:17

StoredProcedure

Post by Filippe » Tue 27 Dec 2016 14:26

Good afternoon.

I have a bank in Mysql.
I'm using Uniquery and UnistoredProc
In the BeforePos event of Uniquery I'm passing the parameters to the a procedure.
this way:

procedure Tfrdm.qrnfitemBeforePost(DataSet: TDataSet);
begin
try
with sptbnfitem_iu do
begin
if not UniConn.InTransaction then
UniConn.StartTransaction;

sptbnfitem_iu.Close;
Params.ParamByName('_idnfitem').asInteger := qrnfitemidnfitem.AsInteger;
Params.ParamByName('_idempresa').AsInteger := qrnfitemidempresa.AsInteger;
Params.ParamByName('_idnfcabecalho').asInteger := qrnfitemidnfcabecalho.asinteger;
Params.ParamByName('_idpro').asInteger := qrnfitemidpro.asinteger;
Params.ParamByName('_codpro').asstring := qrnfitemcodpro.asstring;
Params.ParamByName('_cean').asstring := qrnfitemcean.asstring;
Params.ParamByName('_descricaopro').asstring := qrnfitemdescricaopro.asstring;
Params.ParamByName('_ncm').asstring := qrnfitemncm.asstring;
execute;
UniConn.Commit;
// Filtranfitem(Params.ParamByName('o_idnfitem').AsInteger);
end;
except
on E : Exception do
begin
ShowMessage(E.ClassName+' erro na rotina: qrnfitemBeforePost(): '+E.Message);
sptbnfitem_iu.RestoreUpdates;
UniConn.Rollback;
end;
end;
end;

After completing this routine the data is written to the MySQL database but it has the following error:
"not found Field corresponding parameter _idnfitem'


But when I filter the dataset with return it stops displaying this error
- Filtranfitem (Params.ParamByName ('o_idnfitem'). AsInteger);

But I can not filter the return because they are tax document item.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: StoredProcedure

Post by ViktorV » Tue 27 Dec 2016 16:32

In order to get a detailed answer, please compose a small sample demonstrating the described behavior and send it using the contact form https://www.devart.com/company/contactform.html including scripts for creating database objects.

Post Reply