Loading multiple tables in a datagrid
hi,friends i am developing a windows application in c# how to load multiple tables in a datagrid?any one help me i am new to c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted May 29, 2012, 11:49 PM
If you use .net frame work 2.0 then there is one feature called data relation
DataRelation relTest;
relTest = new DataRelation("DataSetRel",dset.Tables["Table1"].Columns["table1_Id"],dsset.Tables["table2"].Columns["table2_id"]);
dset.Relations.Add(relTest);
assign this dset to datasource of grid.
http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/f122d7f4-3b7d-4d93-bd0f-8bb57cd990a4
Other option if you use framework 3.5 or above then use LINQ-Dataset
please refer
http://msdn.microsoft.com/en-us/library/bb386977.aspx
http://msdn.microsoft.com/en-us/library/bb386969.aspx
var query =("SalesOrderID") equals("SalesOrderID")("OnlineOrderFlag") == true("OrderDate").Month == 8("SalesOrderID"),("SalesOrderDetailID"),("OrderDate"),("ProductID")
from order in orders.AsEnumerable()
join detail in details.AsEnumerable()
on order.Field
detail.Field
where order.Field
&& order.Field
select new
{
SalesOrderID =
order.Field
SalesOrderDetailID =
detail.Field
OrderDate =
order.Field
ProductID =
detail.Field
};
hope this will help u.
kiran kumarPosted Jan 3, 2010, 6:59 AM
kiran kumarPosted Jan 3, 2010, 6:27 AM