how to get the recors from multiple tables

Posted by Dhivakar under Regular Expressions on 2/11/2011 | Points: 10 | Views : 1350 | Status : [Member] | Replies : 6
hi guys...
i want to list the records on the web page from two tables....
i want to list the records like this.
for eg..
product1
item1
item2
product1
item3
item3
products are from products table@ items are from item table


how to do this
pl help me!!!!!!!

Dhivakar.M


Responses

Posted by: Sutotpal on: 2/11/2011 [Member] Starter | Points: 25

Up
0
Down
hi,,

try this query

Select P.products, I.Items from product P,Item I where I.ProductsId_ref=P.products

Best Regards,
Sutotpal

Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prabhakar on: 2/11/2011 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Dhivakar


i think you use join . . join working for ur requirement . .

Best Regard's
Prabhakar

Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhivakar on: 2/11/2011 [Member] Starter | Points: 25

Up
0
Down
i want to list the recodrs on the page like this..
product1
item1
item2
product1
item3
item3
tnx for ur replies...


Dhivakar.M

Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/14/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

you can get this using loopings and #table but first let us know how you want to display it ??

Thanks and Regards
Madhu

Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 2/14/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Try this...
In your query...
Select A.sProductName + '<br/>' + B.sItemName + '<br/>' from tbl_Product A,tbl_Items B where A.nProductId = B.nProdId

Get this query output in DataTable.
Add one label control in your page.
using loop...
for(int x=0; x < dtData.Rows.Count; x++)

{
Label1.Text += dtData.Rows[x][0].ToString();
}

Now you can check the output in your page...

Cheers :)


Thanks,
T.Saravanan

Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 2/14/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

In which control you going to display the result? you can use joins to join the tables and for displaying based on the control you need to do the code...

Thanks
Karthik
www.f5Debug.net

Dhivakar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response