For capturing the errormessage I use these lines of codes:
procedure TDMNAW.SQLnawAfterDelete(DataSet: TDataSet);
var MyQuery : TSQLQuery;
begin
try
MyQuery := TSQLQuery(dataset);
MyQuery.ApplyUpdates;
TSQLtransaction(TsqlQuery(Dataset).Transaction).CommitRetaining
except
showmessage('Record can not removed. Is related to another table');
end;
end;
But when I refresh my records in dataset, my applications complains about the changes that have to applied with
procedure applyupdates(). But applyUpdates() to to delete the record which is impossible by relation.
Is there a way to rollback the applyupdates() so a refresh can be done?
Application is build on lazarus 1.6.2 / FPC 3.0 Windows