请求LINQ查询

时间:2014-04-18 13:13:00

标签: linq sql-to-linq-conversion

我有一个SQL查询。请有人帮我转换成LINQ。

select * from ProductOrder where OrderId != (Select OrderId from OrderEvents) and MemberId=2

我写这段代码。但是这不起作用。请帮我。

                              from order in db.ProductOrder
                              from cancel in db.OrderEvents
                              where order.MemberId == MemberId 
                              where order.OrderId != cancel.OrderId 
                              //orderby order.OrderId descending 
                              select order

1 个答案:

答案 0 :(得分:0)

ProductOrder.Where(x=>x.OrderId != OrderEvents.OrderId && x.MemberId ==2)