Trapping errors in try .. except
Posted on 2002-04-03
Can I know the codes to trapping error returned and displaying appropriate messages?
I have this code :
if DataSet.Modified then
if MessageDlg('Do you want to save the record', mtConfirmation, [mbYes, mbNo],0) = mrNo then
ShowMessage ('Record already exist. (Datamodule) Please enter a different date.');
Currently, if my answer is no, it will create a silent exception and the msg will be shown. I only want that message to be shown if the record already exist in the database. How can i check the error code returned and react accordingly? Thanks!