Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 3 of 3 total |
Triggers again - handling errors raised in triggers |
Wed, Oct 17 2007 11:08 AM | Permanent Link |
Chris Erdal | I'm really getting into triggers, and now that they are beginning to
work, I'm looking for an elegant way to handle the errors I throw in them. 1/ I get an ugly popup saying an error occurred in a database xxx trigger, followed by my really_helpful_message, which is therefore not particularly helpful as the user's already been terrified by the start of the message. What's the simplest elegant way to handle this, please? 2/ My triggers all execute in the DataModule, and so I can't seem to use <the_error_field>.FocusControl as the control to be focused on is on some unknown (to the datamodule) Form, and I don't seem to have a Screen or Application global variable accessible from the datamodule. What can I do about that? I wonder if this is because I create the DataModule first, and the MainForm next iff the Database has been successfully opened? Thanks for any help. -- Chris (XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3) |
Thu, Oct 18 2007 2:01 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Chris,
<< 1/ I get an ugly popup saying an error occurred in a database xxx trigger, followed by my really_helpful_message, which is therefore not particularly helpful as the user's already been terrified by the start of the message. What's the simplest elegant way to handle this, please? >> The easiest way is to simply use a global exception handler for the Application object and test for the trigger error code (DBISAM_TRIGGERERROR (11314)). If it is a trigger error, just strip out the DBISAM part, leaving your "clean" error message, and then display it using a message dialog. << 2/ My triggers all execute in the DataModule, and so I can't seem to use <the_error_field>.FocusControl as the control to be focused on is on some unknown (to the datamodule) Form, and I don't seem to have a Screen or Application global variable accessible from the datamodule. What can I do about that? >> Just include the Forms unit in the USES clause and you should have TScreen and TApplication access. -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Oct 19 2007 1:16 PM | Permanent Link |
Chris Erdal | Thanks, Tim.
have a good weekend. -- Chris (XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 4 + EDB 1.04 build 3) |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |