Wed, 18 Jun 1902 08:00:00 GMT
Handling EDatabaseError afterTTable.post
I created a Paradox table with fields, which require not null values. When I click on the Navigator on a Delphi-Form in order to insert data with null values, consequently an EDatabaseError is raised and the program is stopped by the RTL. I want to supress this harsh reaction and give the user a chance to fill the needed values. If I understand the VCL-Sourcecode, the EDatabaseError-raising procedure is the CheckRequiredFields-method, which is itself called by theTDataSet.Post-method. So I have to get these calls within a try .. except - block, which is closer to raise of the EDatabaseError, than the RTL. How can I do this? The OnPostError-Event and the BeforePost-Event of the Table are applied after the call of CheckRequiredFields, so they come too late. I tried check the fields in the OnUpdate-Event in a try .. except block and to raise an EDatabaseError myself, if the value is null - but this cannot cancel the TDataSet.post-call, which already happened outside the sheltered area. In ordinary Pascal I would derive a new component from TTable in order to control the post-method. But this simple problem must admit a solution by native Delphi-methods. Thanks a lot for all helpfull advices. Tho...@Lauer.in-berlin.de
|