Código Delphi
[-]
while not QEasy.Eof do
begin
TCT_TOTAL.Append;
for i := 0 to QEasy.Fields.Count - 1 do
TCT_TOTAL.Fields[i].Value := QEasy.Fields[i].Value;
try
TCT_TOTAL.Post;
except
on E: EDatabaseError do
begin
if Pos('KEY VIAOLATION', E.Message) > 0) then
begin
Texto := 'Duplicado el registro con ID: ' + QEasy.FieldByName('ID_CT').AsString;
Application.MessageBox(PChar(Texto), 'Registro duplicado',mb_Ok+MB_ICONEXCLAMATION);
TCT_TOTAL.cancel;
end else
raise;
end;
end;
QEasy.Next;
end;
Lo que quieren decir los compañeros es esto... y cárgate el OnPostError