Board index » delphi » EDatabaseError using Access 2000 & D5

EDatabaseError using Access 2000 & D5

When posting a duplicate record on  an Access 2000 dataset that is not
allowed to have duplicates, the OnPostError event is triggered.

How can I get an error message number so that I can
deferentiate one error from another.
I want to display my own error message.
The variable EDatabaseError as far as I can see only has the "message"
property.  I do not want to display this lengthy message to the user. I
want to display my own message depending on the error number.

Thanks in advance,
Robert Gilbert

 

Re:EDatabaseError using Access 2000 & D5


Quote
Robert Gilbert <rgilb...@wtjam.net> wrote in message

news:83ufje$5mq16@forums.borland.com...

Quote
> How can I get an error message number so that I can
> deferentiate one error from another.
> I want to display my own error message.

You should be able to use the Errors property on the TADOConnection component.
It's a collection of Error objects which will have a Number property you can
use.  Something like this:

  if ADOConnection1.Errors[0].Number = KEY_VIOL then
    ShowMessage('Key Violation');

I'm not sure what value you would use for the KEY_VIOL constant though.   There
is also a NativeError property to that you be able to use.

Mark

Other Threads