Key Viloation canceling post in OnBeforePost
Posted on 1999-12-13
Ok, so I have a TDBGrid, in the OnBeforePost event of the table (=TDBGrid.DataSource.DataSet) I ask the user a question, if they say no I cancel the post by calling table.cancel. This line is executed but I then get an EDbEngineError exception saying there is a key Violation, Violation of primary index constraint, cannot insert duplicate key in object table. The record being cancelled does not have a duplicate key anyway. Why is this happening? (I have tried raising an exception, which works, but closes the app.) I just want it to cancel and let the user continue. What am I doing wrong?