DelphiFAQ Home Search:
General :: Programming :: Delphi :: Database
Database development with Delphi. Includes issues with BDE, ADO and InterBase.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

Obtaining more information about BDE Errors

When working with the Borland Database Engine (BDE) you've probably seen exceptions raised by the BDE.

Examples:

  • 'Key violation'
  • 'Table does not exist'
The raised exception EDBEngineError is a subclass of the Exception class, one with additional functionality not provided in the base class.

Specifically, EDBEngineError errors are lists of other error messages. You can enumerate the error messages and display them as additional information when problems occur, as shown in the following example.

program BDE_Error_Demo;
 
 var
   sMsg: String;
   i   : integer;
 
 // Uses the EDBEngineError's ErrorCount() method to enumerate all errors 
 // on BDE's stack of messages. They are collected in a string and displayed. 
 begin 
   try 
     
   // something prone to errors.. 
 
   except 
     on e : EDBEngineError do 
       begin 
         sMsg := 'BDE Error Details:' + #13#10#13#10; 
         
         for i := 0 to ErrorCount - 1 do 
         begin 
           sMsg := strErrors + '(' + IntToStr(Errors[i].ErrorCode) + 
                   ') ' + Errors[i].Message + #13#10 
         end; { for i }
 
         Application.MessageBox(PChar(sMsg), 'Error', MB_ICONHAND + MB_OK) 
       end; 
   end; { try } 
 end.

Generated 8:01:12 on May 25, 2018