What is the syntax for an inner join in LINQ to SQL?

后端 未结 19 1646
感情败类
感情败类 2020-11-22 04:25

I\'m writing a LINQ to SQL statement, and I\'m after the standard syntax for a normal inner join with an ON clause in C#.

How do you represent the follo

19条回答
  •  误落风尘
    2020-11-22 04:59

    var q=(from pd in dataContext.tblProducts join od in dataContext.tblOrders on pd.ProductID equals od.ProductID orderby od.OrderID select new { od.OrderID,
     pd.ProductID,
     pd.Name,
     pd.UnitPrice,
     od.Quantity,
     od.Price,
     }).ToList(); 
    

提交回复
热议问题