如何将以下sql查询更改为LINQ
select top(5) *
from Tradingdays
where Trading_date <'2014-10-16 00:00:00.000'
and holiday !=1
order by id desc
答案 0 :(得分:1)
DateTime yourDate = new DateTime(2014,10,16,0,0,0,0);
var list = (from t in datacontext.TradingDays
where t.Trading_date < yourDate && t.holiday != 1
orderby t.id desc
select t).Take(5);