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.