Article View: borland.public.cppbuilder.database.ado
Article #5129Detecting errors in multiple queries
From: Formentz
Date: Wed, 18 Jul 2001 16:22
Date: Wed, 18 Jul 2001 16:22
24 lines
1722 bytes
1722 bytes
Hi all,
I'm using ADO with SQL Server.
I have a multiple query like this :
ADOQuery->SQL->Clear();
ADOQuery->SQL->Add("declare @code integer");
ADOQuery->SQL->Add("update counters set code=code+1");
ADOQuery->SQL->Add("select @code=code from counters");
ADOQuery->SQL->Add("insert into Table1(c_code) values(@code)");
ADOQuery->ExecSQL();
Now, Table1 has a unique index (primary key) on the field c_code and if I
try to insert a value of c_code that already exists it should throw an
exception.
But it doesn't throw it, the query seems to execute with no error, but the
record isn't inserted.
If you do only the insert into specifying a value that already exists the
error is correctly thrown :
ADOQuery->SQL->Text="insert into Table1(c_code) values(1)";
Is there a way to know when the record is inserted or not, using the
multiple query?
TIA
Ciao
Formentz
Technical Details
Message-ID:
<3b55b697_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!netnews.com!xfer02.netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,37ceee28dab182b3,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-07-18 09:20:26 PST From: "Formentz" <francesco@leotron.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Detecting errors in multiple queries Date: Wed, 18 Jul 2001 18:22:16 +0200 Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 62.122.25.133 Message-ID: <3b55b697_1@dnews> X-Trace: dnews 995473047 62.122.25.133 (18 Jul 2001 09:17:27 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!netnews.com!xfer02.netnews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews