0

Hello,

I'm making a phone book application (ASP.NET, C#). 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.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Ramy Mahrous
0

Attach your entity-relationship diagram and tell us what you need to extract from your database, and what're your tryings??

0

Hello,

thank you for your post.
I found a solution of doing this simply with one sql query in which I combined 2 tables with LEFT OUTER JOIN.

so, I no longer need help on first matter.

However could you please explain what you mean by "entity-relationship diagram"? what is it? also, when shall I use Dataset thing on .net?

thanks a bunch!

Attach your entity-relationship diagram and tell us what you need to extract from your database, and what're your tryings??

0

- Entity-relation diagrams, it's diagram contains your entites (tables in physical design) and their relationship, find more on wikipedia.org
- Dataset represent your database in memory, used in disconnected mode, you can read about it, I gave you the key "disconnected mode"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.