Article View: borland.public.cppbuilder.database.ado
Article #2349Re: Creating multiple records with one entry
From: Lee
Date: Thu, 28 Aug 2003 16:22
Date: Thu, 28 Aug 2003 16:22
54 lines
2777 bytes
2777 bytes
well, it seems that I have solved my own problem, but I am sure there is an
easier way to do it.
what I did was check the registry for the tables values of 1 (means they
have been created) if the had been I then wrote the ID number to that table.
The big problem is that there is a lot of same code, but they all have the
autoincrementing number
Now I just need to create the relations between them all...
Any ideas on that aspect?
"Lee" <gobroski@elltel.net> wrote in message
news:3f4cb1db$1@newsgroups.borland.com...
> 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:
<3f4e2c4f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!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-mailReferences:
<3f4cb1db$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,66e3b22bb1b7d06f X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-08-28 09:26:28 PST From: "Lee" <gobroski@elltel.net> Newsgroups: borland.public.cppbuilder.database.ado References: <3f4cb1db$1@newsgroups.borland.com> Subject: Re: Creating multiple records with one entry Date: Thu, 28 Aug 2003 09:22:39 -0700 Lines: 56 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: <3f4e2c4f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1062087759 12.18.161.26 (28 Aug 2003 09:22:39 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!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