PDA

View Full Version : How can I handle EDbEngineError


Nathan2001
07-23-2001, 03:57 AM
Now I want to handle Key voildation.I know the ErrorCode
is 9729.So,How can I use it handle the Error?Not in Table's
OnUpdateError.

try
table1.Post;
except
on EDbEngineError do
begin
What can I write here?
end;
end;

Thaks,nathan.

cs
07-24-2001, 09:29 AM
My advise to you:

const
eKeyViol = 9729; (as you know)
var
ErrCode: Integer;
begin
try
DataSet.Post;
except
on E: EDBEngineError do begin
ErrCode := (E as EDBEngineError).Errors[0].ErrorCode;
if ErrCode = eKeyViol then
ShowMessage('Error message');
end;
end;