Duplicate key or required field

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Duplicate key or required field

Post by oz8hp » Wed 28 Oct 2009 07:18

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.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 28 Oct 2009 09:44

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.

Post Reply