我有这个Linq查询。我想一起显示ab.InTime和DbFunctions值
var sdv = (from ab in db.Attendances
where ab.Employee == 63 && ab.InTime.Value.Year == 2015 && ab.InTime.Value.Month == 8
select ab.InTime,DbFunctions.DiffMinutes(ab.InTime, ab.OutTime) / 60);
答案 0 :(得分:1)
也许,您可以使用select new{...}
。请试试这个:
var sdv = (from ab in db.Attendances
where ab.Employee == 63 && ab.InTime.Value.Year == 2015 && ab.InTime.Value.Month == 8
select new{
InTime=ab.InTime,
Minutes=DbFunctions.DiffMinutes(ab.InTime, ab.OutTime) / 60)
};