🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Can't insert ot update with TADOQuery on Access2000

#3813
From: Andre Schutte
Date: Sun, 02 Jun 2002 12:25
44 lines
2055 bytes
Hi

I'm trying to insert and update information in an Access2000 table using
TADOQuery, and i can't get it
to work, Selecting works 100%.

the code i'm using is....

TADOConnection *ADOConnection = new TADOConnection(NULL);
TADOQuery *ADOQuery = new TADOQuery(NULL);

ADOConnection->Connected=false;
ADOConnection->ConnectionString=<connection_string_variable_here>;
ADOConnection->LoginPrompt=false;
ADOConnection->Connected=false;

ADOQuery->Close();
ADOQuery->Connection=ADOConnection;

ADOConnection->BeginTrans();
try {
  ADOQuery->SQL->Clear();
  ADOQuery->SQL->Add("MY INSERT STATEMENT HERE");
  ADOQuery->Prepared=true;
  ADOQuery->ExecSQL();
  ADOConnection->CommitTrans();
} catch(...) {
  ADOConnection->RollbackTrans();
}
ADOQuery->Close();
ADOConnection->Connected=false;

delete ADOQuery;
delete ADOConnection;

if i copy the exact sql statement and run it in mssaccess2000, it executes
properly,
but not within my application.

ADOConnection is connecting properly, it juist appears that the ADOQuery
keeps rolling back
the transaction.

any idea as to why this is happening?
Technical Details
Message-ID: <3cfa0ebc_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!telocity-west!TELOCITY!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,fa7071dbfcab81f0,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-06-02 05:38:53 PST
Reply-To: "Andre Schutte" <andre.schutte@webmail.co.za>
From: "Andre Schutte" <andre.schutte@webmail.co.za>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Can't insert ot update with TADOQuery on Access2000
Date: Sun, 2 Jun 2002 14:25:40 +0200
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
NNTP-Posting-Host: 196.39.51.4
Message-ID: <3cfa0ebc_1@dnews>
X-Trace: dnews 1023020732 196.39.51.4 (2 Jun 2002 05:25:32 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!telocity-west!TELOCITY!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews