| | |
selecting from a table and listing various data from another one related to the first
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2009
Posts: 12
Reputation:
Solved Threads: 0
selecting from a table and listing various data from another one related to the first
0
#1 Jan 8th, 2009
Hello,
I'm making a phone book application. I store general information of people such as name etc on one table called "people", and I've another table called "relatedInformation" which has 5 columns (ID, Name, Info, PersonID, Type). In this table I store all other information regarding people, because a person might have more than one address, phone number or email.
So let's say there is I got one row data from People table with SqlDataReader, and print the "Name" value on the screen.
Now what I want is, I want to do another query to "relatedInformation" table, select data where Type is 1 (phone numbers), and PersonID is the ID from "People" table. so I can list all phone numbers.
Then another query but this time select the ones where Type is 2 (addresses, for example.)
what is the logic behind doing this with C# and ASP.NET ?
if I create data command and then a data reader and stuff for each one of these things, code becomes really heavy.
In old ASP it only took 2 lines of code to do this with using RecordSet.
Can you please explain me the logic of doing this and, if possible help me with some code?
And if i couldn't make my self clear, please ask me so I can explain more clearly.
Thank you very much.
I'm making a phone book application. I store general information of people such as name etc on one table called "people", and I've another table called "relatedInformation" which has 5 columns (ID, Name, Info, PersonID, Type). In this table I store all other information regarding people, because a person might have more than one address, phone number or email.
So let's say there is I got one row data from People table with SqlDataReader, and print the "Name" value on the screen.
Now what I want is, I want to do another query to "relatedInformation" table, select data where Type is 1 (phone numbers), and PersonID is the ID from "People" table. so I can list all phone numbers.
Then another query but this time select the ones where Type is 2 (addresses, for example.)
what is the logic behind doing this with C# and ASP.NET ?
if I create data command and then a data reader and stuff for each one of these things, code becomes really heavy.
In old ASP it only took 2 lines of code to do this with using RecordSet.
Can you please explain me the logic of doing this and, if possible help me with some code?
And if i couldn't make my self clear, please ask me so I can explain more clearly.
Thank you very much.
Re: selecting from a table and listing various data from another one related to the first
0
#2 Jan 8th, 2009
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Related to gridview
- Next Thread: how to retrieve fullname after login(asp.net/c#/sql)
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax appliances asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class click compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dialog dropdownmenu dynamic edit embeddingactivexcontrol feedback findcontrol flash flv form forms gridview homeedition hosting iframe iis javascript jquery list menu mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings relationaldatabases rotatepage save search security serializesmo.table sessionvariables silverlight smartcard sql ssl suse textbox tracking treeview typeof unauthorized validatedate validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml





