Article View: borland.public.cppbuilder.database.ado
Article #1161TADOQuery, MSSQL and @@IDENTITY
From: Brad Arant
Date: Sat, 09 Oct 2004 00:08
Date: Sat, 09 Oct 2004 00:08
22 lines
1358 bytes
1358 bytes
Hello Gang,
Having troubles using @@IDENTITY fields under TADOQuery after an INSERT INTO
statement. Retrieves a value of 32 everytime. Just wondering if anybody
could give me some pointers on this.
DBQuery = new TADOQuery(NULL);
DBQuery->Connection = DBConnection;
DBQuery->SQL->Text = "insert into .................";
DBQuery->ExecSQL();
DBQuery->SQL->Text = "select @@identity as id";
DBQuery->Open();
int Value;
DBQuery->GetFieldData(DBQuery->FieldByName("id", &Value);
The Value variable is always = 32.
Technical Details
Message-ID:
<ck7a6001ecg@news1.newsguy.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!news.cambrium.nl!news.cambrium.nl!npeer.de.kpn-eurorings.net!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!news1Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,a7729e171b57f80,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!news.cambrium.nl!news.cambrium.nl!npeer.de.kpn-eurorings.net!pln-w!spln!dex!extra.newsguy.com!newsp.newsguy.com!news1 From: "Brad Arant" <barant@barant.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: TADOQuery, MSSQL and @@IDENTITY Date: Fri, 8 Oct 2004 17:08:44 -0700 Organization: http://newsguy.com Lines: 26 Message-ID: <ck7a6001ecg@news1.newsguy.com> NNTP-Posting-Host: p-756.newsdawg.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original