Article View: borland.public.cppbuilder.database.ado
Article #2347Creating multiple records with one entry
From: Lee
Date: Wed, 27 Aug 2003 13:28
Date: Wed, 27 Aug 2003 13:28
32 lines
2120 bytes
2120 bytes
I have created a primary key on my student information table,
autoincrementing. Now I would like that number to becopied on to the other
tables that I have created.
How I did the autoincrementing was a little odd I am wondering if there is a
better way to do this:
Data->Table->Connection = Data->Connection;
Data->Table->TableName = "StudentInformation";
Data->DataSet->CommandType = cmdTable;
//opens student information
Data->DataSet->CommandText = "StudentInformation";
Data->DataSet->Open();
Data->Table->Active = true;
Data->Table->Insert();
Data->Table->FieldByName("ID")->AsInteger = Data->DataSet->RecordCount +
1; //checks the number of records and adds one, every time I add a new one.
Data->Table->FieldByName("SID")->AsInteger = StrToInt(Edit1->Text);
Data->Table->FieldByName("Last")->AsString = Edit2->Text;
Data->Table->FieldByName("First")->AsString = Edit3->Text;
Data->DataSet->Close();
Data->Table->Post();
Edit1->SetFocus();
Button1->Caption = "Next Student";
Edit1->Clear();
Edit2->Clear();
Edit3->Clear();
Thanks.
Lee
Technical Details
Message-ID:
<3f4cb1db$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news-xfer1.atl.newshosting.com!63.218.45.11.MISMATCH!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,66e3b22bb1b7d06f,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-08-27 06:33:56 PST From: "Lee" <gobroski@elltel.net> Newsgroups: borland.public.cppbuilder.database.ado Subject: Creating multiple records with one entry Date: Wed, 27 Aug 2003 06:28:07 -0700 Lines: 34 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: 12.18.161.26 Message-ID: <3f4cb1db$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1061990875 12.18.161.26 (27 Aug 2003 06:27:55 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news-xfer1.atl.newshosting.com!63.218.45.11.MISMATCH!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail