Solved

BDE Engine Exception Handling

Posted on 1998-09-08
6
609 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
ID: 1338984
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
ID: 1338985
I think Ktoshni want error's reason, not common phrase 'Ops DB Error'
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1338986
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:viktornet
ID: 1338987
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
ID: 1338988
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
ID: 1338989
Sorry....My query didn't work and I must have sent all those messages...sorry...

Regards,
Viktor Ivanov
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 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

22 Experts available now in Live!

Get 1:1 Help Now