public ActionResult Day(){ var q = from o in _db.Ordersgroup o by o.OrderStateinto gselect new {g.Key, Count = g.Sum(o => o.Id)};return View(q);}以是有控制器中的代码,视图层: @foreach (var item in Model)
{ <td>@item.Key</td>
}异常:object”未包含“Key”的定义,但是直接显示@item的话会显示{Key=ABC,Count=12}.求解
添加回答
举报
0/150
提交
取消