ch11lev1sec9

   

Error Handling Issues

The trouble with ADO error messages is that they are terrible and nonspecific. It is not unusual to get an exception that says only "Errors occurred" or that claim a problem with the type of a field without saying which field is at issue.

Unlike the EDBEngineError that returns detailed BDE error messages in series, EADOError is your only source of error information from a thrown exception, and it might be uselessly nonspecific. Be prepared for some frustration when dealing with ADO component errors that are reported by ADO itself.

Note, however, that the TADOConnection offers an Errors property that can be indexed. Sadly, it seems this seldom offers additional information. However, if you want to try working with it, the following loop can access individual error messages from the TADOConnection::Errors :

 for (int Index = 0; Index < ADOConnection1->Errors->Count; Index++)  {      String Message = ADOConnection1->Errors->Item[Index]->Description;  }; 

See the file $(BCB)\source\vcl\ADOInt.pas (note: $(BCB) is the standard environment variable referring to the C++Builder installation directory) for more information on the Error properties, such as Description , but be aware that source is written in Object Pascal (Delphi), not C++.


   
Top


C++ Builder Developers Guide
C++Builder 5 Developers Guide
ISBN: 0672319721
EAN: 2147483647
Year: 2002
Pages: 253

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net