Uniquery Error
Posted: Tue 15 Apr 2014 16:55
Hi All,
I have this code:
On Post, I have thi error: Project raised exception class EDatabaseError whit message 'Update failed. Found 0 records'. And the update isn't executed.
I have this error in Step Over (F8) debug.
Can you help me?
Thanks,
Flavio
I have this code:
Code: Select all
procedure TFrm_ArchivioClienti.My_Save_InfoOrdine;
var Myinfo:TInfoOrdine; MyQ:TUniQuery;
begin
Myinfo:=TInfoOrdine.Create;
with Myinfo do
begin
idordine:=MySelectedOrder;
dataordine:=txtdataordine.Date;
ordidcli:=MySelectedCliente;
ordidagent:=-1;
numordine:=txtnumeroordine.Text;
if(Switchstatoordine.IsChecked) then
begin
stato:=0;
statotxt:='Ordine da Evadere';
end
else
begin
stato:=1;
statotxt:='Ordine Evaso';
end;
totaleordine:=0;
end;
MyQ:=TUniQuery.Create(self);
with MyQ do
begin
Connection:=mydm.SqlLiteConn;
close;
sql.Clear;
sql.Add('select * from ordine where idordine=:anid');
ParamByName('anid').Value:=Myinfo.idordine;
open;
end;
if(Myq.RecordCount > 0) then
begin
with MyQ do
begin
edit;
FieldByName('dataordine').Value:=Myinfo.dataordine;
FieldByName('ordidcli').Value:=Myinfo.ordidcli;
FieldByName('ordidagent').Value:=Myinfo.ordidagent;
FieldByName('numordine').Value:=Myinfo.numordine;
FieldByName('stato').Value:=Myinfo.stato;
FieldByName('statotxt').Value:=Myinfo.statotxt;
try
begin
Connection.StartTransaction;
Post;
Connection.Commit;
// result:=true;
end;
except on E: Exception do
begin
if(Connection.InTransaction) then
Connection.Rollback;
// result:=false;
end;
end;
end;
end;
Myq.Close;
Myq.Free;
end;
I have this error in Step Over (F8) debug.
Can you help me?
Thanks,
Flavio