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.
StoredProcedure
Re: StoredProcedure
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.