Page 1 of 1

Duplicate key or required field

Posted: Wed 28 Oct 2009 07:18
by oz8hp
I am trying to create an application that uses the TCRDBGrid to insert records in a table - this is working very nicely, but when inserting a record that violates a index for unique values I can't figure out how to catch the error and cancel the insert.
The problem is the same if I try to insert a record that doesn't have all the needed data - how do I catch this.

I have been looking at all the samples found with the UniDAC demo, but with no luck. So a detailed description would be very nice.

Posted: Wed 28 Oct 2009 09:44
by Plash
There is no way to do this directly.

You can try to use the TApplicationEvents component and OnException event. In the event handler you can check the exception message.