Article View: borland.public.cppbuilder.database.ado
Article #2356Re: Creating multiple records with one entry
From: Gary
Date: Fri, 29 Aug 2003 22:44
Date: Fri, 29 Aug 2003 22:44
98 lines
4150 bytes
4150 bytes
I would have done something like this: ( I'll do it in English but you
should get the idea)
//User Clicks ADD RECORD
MASTER Student Data Table Required Field: (User must supply a value)
Student ID (NO Duplicates allowed by code)
Other Fields:
LastNm: Duplicates OK
FirstNm: Duplicates OK
... (Etc as needed)
// User adds Student Class & Grade Information
Student Grades SUBTABLE Required Fields: (User must supply a value)
Student ID (Auto Populated by code when Student Name is Selected, Duplicates
OK) (Field can be HIDDEN)
Class Taken: Duplicates OK ( incase of drop & reenrollment etc)
Other Fields:
LastNm: Duplicates OK (Read-Only ComboBox; user must select from active
students)
FirstNm: Duplicates OK (Auto Populated by code)
Grade: Duplicates OK
... (Etc as needed)
// User Requests Student Record to be Displayed on Screen or by Printer:
Select Student by search for Student ID or a Name field or by selection from
a ComboBox
Display MASTER Record in DBTextBoxes over a DBGrid which lists all
Student Grades (or whatever) using query filtered by Student ID to populate
the grid.
Done Deal.
"Lee" <gobroski@elltel.net> wrote in message
news:3f4e2c4f$1@newsgroups.borland.com...
> 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:
<3f4fd746@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!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> <3f4e2c4f$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-29 15:48:01 PST Reply-To: "Gary" <gcdesroches@mindspring.com> From: "Gary" <gcdesroches@mindspring.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3f4cb1db$1@newsgroups.borland.com> <3f4e2c4f$1@newsgroups.borland.com> Subject: Re: Creating multiple records with one entry Date: Fri, 29 Aug 2003 17:44:43 -0500 Lines: 100 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: 66.38.45.163 Message-ID: <3f4fd746@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1062197062 66.38.45.163 (29 Aug 2003 15:44:22 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail