If I remember correctly then you should use Abort() instead of Cancel();
TDataSet->Cancel() still allowing Post to proceed
-
17-01-2022 - |
Question
I am in a BeforePost event handler hoping to cancel the post before it goes through. At the end of my BeforePost function I call DataSet->Cancel(); and when debugging through this I see it go from my function to the TDataSet.DoBeforePost function then to the TDataSet.Post; where it calls CheckOperation(). CheckOperation throws an exception (which I tried to avoid by calling Cancel() ) because the data is incorrectly entered and the user sees this error.
Is there something in this order of operations that I am doing wrong? Any kind of ideas or guidance would be greatly appreciated.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow