🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2276

Re: EDatabaseError Exception ; Need more than that ...

#2276
From: Charles Maples
Date: Sun, 28 Sep 2003 21:52
72 lines
3176 bytes
Hi Daryl

See the code below you can get error information from the connection ADO
Connection Component

 for(int i = 0; i < ADOConnection1->Errors->Count;i++)
        {

Application->MessageBox(AnsiString(ADOConnection1->Errors->Item[i]->Source).
c_str(),"Source",0);

Application->MessageBox(IntToStr(ADOConnection1->Errors->Item[i]->Number).c_
str(),"Number",0);

Application->MessageBox(AnsiString(ADOConnection1->Errors->Item[i]->Descript
ion).c_str(),"Description",0);

Application->MessageBox(AnsiString(ADOConnection1->Errors->Item[i]->SQLState
).c_str(),"SQLState",0);

Application->MessageBox(IntToStr(ADOConnection1->Errors->Item[i]->NativeErro
r).c_str(),"NativeError",0);

Application->MessageBox(AnsiString(ADOConnection1->Errors->Item[i]->HelpFile
).c_str(),"HelpFile",0);

Application->MessageBox(AnsiString(ADOConnection1->Errors->Item[i]->HelpCont
ext).c_str(),"HelpContext",0);
        }

You will also need to add

#pragma alias
"@System@@CheckAutoResult$qqrv"="@System@@CheckAutoResult$qqrl"

To your code


Charles

"Daryl" <stockd@tpg.com.au> wrote in message
news:3f4e7cc2@newsgroups.borland.com...
> Hi all
> When using the event method for OnPostError, example below.  Note: I have
> customised the default name to mine so it can be generalised so I can use
it
> for a few datasets.
>
> void __fastcall TDMLab::PostErrorMgr(TDataSet *DataSet, EDatabaseError *E,
> TDataAction &Action)
> {
>   // My code to handle the error thrown.
>   // I want to use a case statement of ErrorCodes
> }
>
> The problem I am having is that  exception " EDatabaseError *E  " supplied
> when choosing this event does not provide the ADO error number.  The
message
> is supplies is OK but I am after a way to trap for the error numbers .  I
> think there is a EOleSysError Message and ErrorCode properties that supply
> this information but I can not find a way to get this data using what is
> supplied ie EDatabaseError.  Is there a way to cast to another object type
> to get this information???
>
> How do other people handle this problem using VCL ADO components????
>
> Look any direction / information would be good...
>
> Thanks
> Daryl
>
>
Technical Details
Message-ID: <3f77588a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f4e7cc2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,fd4f251e50776ec4
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-09-28 15:09:07 PST
From: "Charles Maples" <CharlesM@Tampabay.rr.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3f4e7cc2@newsgroups.borland.com>
Subject: Re: EDatabaseError Exception ; Need more than that ...
Date: Sun, 28 Sep 2003 17:52:03 -0400
Lines: 74
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 65.32.45.209
Message-ID: <3f77588a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1064786058 65.32.45.209 (28 Sep 2003 14:54:18 -0700)
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail