Article View: borland.public.cppbuilder.database.ado
Article #2357Re: Creating multiple records with one entry
From: Lee
Date: Sat, 30 Aug 2003 07:54
Date: Sat, 30 Aug 2003 07:54
121 lines
4820 bytes
4820 bytes
Gary,
Thanks for your response. I don't think what you have suggested would work
for me. it seems from reading your idea, it would make the duplicate
records on the same table. I need them written to different tables.
I hope that I understood your idea correctly though.
Thanks
Lee
"Gary" <gcdesroches@mindspring.com> wrote in message
news:3f4fd746@newsgroups.borland.com...
> 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:
<3f50581e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-05!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!news-xfer.cox.net!peer01.cox.net!cox.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f4cb1db$1@newsgroups.borland.com> <3f4e2c4f$1@newsgroups.borland.com> <3f4fd746@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-30 01:08:28 PST From: "Lee" <gobroski@elltel.net> Newsgroups: borland.public.cppbuilder.database.ado References: <3f4cb1db$1@newsgroups.borland.com> <3f4e2c4f$1@newsgroups.borland.com> <3f4fd746@newsgroups.borland.com> Subject: Re: Creating multiple records with one entry Date: Sat, 30 Aug 2003 00:54:03 -0700 Lines: 123 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: <3f50581e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1062230046 12.18.161.26 (30 Aug 2003 00:54:06 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-05!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!news-xfer.cox.net!peer01.cox.net!cox.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail