Solved

BDE Engine Exception Handling

Posted on 1998-09-08
6
604 Views
Last Modified: 2013-11-23
I'm new to Delphi (Using Delphi 1) and I am experimenting with the BDE engine on an Interbase Local Server. My question is how do I use the EDBENGINEERROR exception handler properly so as catch the reason for any errors to be displayed in a dialog box. The on-line help is not very clear about this.
0
Comment
Question by:Ktoshni
  • 5
6 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
Comment Utility
begin
  ///some code or maybe not
  try
    ///some more code
  except on EDBENGINEERROR
    ShowMessage('Ops DB Error');
  end;
end;

Regards,
Viktor Ivanov

0
 
LVL 3

Expert Comment

by:vladika
Comment Utility
I think Ktoshni want error's reason, not common phrase 'Ops DB Error'
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Ok, here is a snippet from the help file,,,,
------------
The E parameter is usually of type EDBEngineError. From this exception type, you can extract an error message that you can display to users in your error handler. For example, the following code could be used to display the error message in the caption of a dialog box:

ErrorLabel.Caption := E.Message;

This parameter is also useful for determining the actual cause of the update error. You can extract specific error codes from EDBEngineError, and take appropriate action based on it. For example, the following code checks to see if the update error is related to a key violation, and if it is, it sets the UpdateAction parameter to uaSkip:

{ Add 'Bde' to your uses clause for this example}
if E is EDBEngineError then
 with EDBEngineError(E) do
 begin
   if Errors[ErrorCount - 1].ErrorCode = DBIERR_KEYVIOL then
     UpdateAction := uaSkip  { Key violation, just skip this record }
   else
     UpdateAction := uaAbort { Don't know what's wrong, abort the update }
 end;
---------------
Regards,
Viktor Ivanov
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Ok, here is a snippet from the help file,,,,
------------
The E parameter is usually of type EDBEngineError. From this exception type, you can extract an error message that you can display to users in your error handler. For example, the following code could be used to display the error message in the caption of a dialog box:

ErrorLabel.Caption := E.Message;

This parameter is also useful for determining the actual cause of the update error. You can extract specific error codes from EDBEngineError, and take appropriate action based on it. For example, the following code checks to see if the update error is related to a key violation, and if it is, it sets the UpdateAction parameter to uaSkip:

{ Add 'Bde' to your uses clause for this example}
if E is EDBEngineError then
 with EDBEngineError(E) do
 begin
   if Errors[ErrorCount - 1].ErrorCode = DBIERR_KEYVIOL then
     UpdateAction := uaSkip  { Key violation, just skip this record }
   else
     UpdateAction := uaAbort { Don't know what's wrong, abort the update }
 end;
---------------
Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Ok, here is a snippet from the help file,,,,

The E parameter is usually of type EDBEngineError. From this exception type, you can extract an error message that you can display to users in your error handler. For example, the following code could be used to display the error message in the caption of a dialog box:

ErrorLabel.Caption := E.Message;

This parameter is also useful for determining the actual cause of the update error. You can extract specific error codes from EDBEngineError, and take appropriate action based on it. For example, the following code checks to see if the update error is related to a key violation, and if it is, it sets the UpdateAction parameter to uaSkip:

{ Add 'Bde' to your uses clause for this example}
if E is EDBEngineError then
 with EDBEngineError(E) do
 begin
   if Errors[ErrorCount - 1].ErrorCode = DBIERR_KEYVIOL then
     UpdateAction := uaSkip  { Key violation, just skip this record }
   else
     UpdateAction := uaAbort { Don't know what's wrong, abort the update }
 end;
0
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
Sorry....My query didn't work and I must have sent all those messages...sorry...

Regards,
Viktor Ivanov
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now