Thursday, 8 March 2012

Inner join with LINQ in SharePoint 2010



var x = from cust in dataContext.Customers.ToList()
join ord in dataContext.Orders.ToList()
on cust.CustomerID.ToString().Trim() equals
ord.CustomerID.CustomerID.ToString().Trim()
select new
{
CustomerID = cust.CustomerID,
Title = cust.Title,
City = cust.City,
CustomerCountry = cust.CustomerCountry,
JoiningDate = cust.JoiningDate,
OrderTitle = ord.Title
};
dataGrdCustomer.DataSource = x.ToList();

No comments:

Post a Comment