I want to have strict updates enabled, but I want to trap the error message and do something. Is this possible? If not can I make a request for event OnStrictupdateError!
Thanks
Ken
Strict Update
You can use try..except statements to catch strict update exceptions:
Code: Select all
try
MSQuery1.Edit;
MSQuery1.FieldByName('SomeFieldName').AsString := 'some value';
MSQuery1.Post;
except
on E: EDatabaseError do
//Check the MSQuery1.RowsAffected property
end;
You can also set the TMSQuery.Options.StrictUpdate property to False and check the TMSQuery.RowsAffected property value in the TDataSet.AfterPost event.
The most proper way, in our opinion, is to add an unique primary key field to the table. It will guarantee that updates will affect only one record.
The most proper way, in our opinion, is to add an unique primary key field to the table. It will guarantee that updates will affect only one record.