Handling Database Exception with ADO

From: Franco Caravello (fcaravello_at_atomos.it)
Date: 01/16/04


Date: 16 Jan 2004 01:47:49 -0800

I had the following handling routines in Paradox/Interbase for key violations:
try
tblSample.post;
    except
      on E: EDBEngineError do
        if E.Errors[E.ErrorCount - 1].ErrorCode = 9729 then begin
.....................................

How would I trap the same error with ADO?

Can I retrieve an SQLcode like "-803" or "100" (std SQL errors code)?

Tanks



Relevant Pages

  • exception handling
    ... would like to trap key violations so that a more user friendly message can be displayed. ... If i was using the BDE I think I might do something like this in the posterror event ... As this is not the BDE, what is the comparable code for ado? ...
    (borland.public.delphi.database.ado)
  • Re: ADO UpdateBatch Problems
    ... Have you tried wrapping your UpdateBatch in a Try...except block. ... You are searching for specific error ... ADO to be precise. ... Just check for any kind of error and see if you can trap ...
    (borland.public.delphi.database.ado)
  • Re: Early Kursk
    ... Many of the new tanks turned out unreliable, ... Russians had set a trap. ... in a neat bow (from around the time window when Russian archives ... a particulary uncertain fog of war here. ...
    (soc.history.war.world-war-ii)
  • ASP error traping problem
    ... I am unable to trap and handle errors in ASP. ... When in the function and error is raised (ADO or VBscript ...
    (microsoft.public.scripting.vbscript)
  • Re: Using VB6 ADO - How do you like to detect if a MS ACCESS record has been ALTERED SUCCESSFULL
    ... I would trap the runtime error ADO/Access would throw when a db ... operation fails. ... ADO Update, Append, or Deletion of a Microsoft Access 2002 has ...
    (comp.databases.ms-access)