所以有用到這東西
所以紀錄一下
Linq 用法
var LinqDataSource = from a in Linq.Mains
group a by a.date.Date into b
orderby b.Key
select new
{
Date = b.Key,
Total = b.Count(),
Project1 = b.Where(x => x.ProjectNo == 1).Count(),
Project3 = b.Where(x => x.ProjectNo == 3).Count(),
Project5 = b.Where(x => x.ProjectNo == 5).Count(),
Project7 = b.Where(x => x.ProjectNo == 7).Count(),
Project9 = b.Where(x => x.ProjectNo == 9).Count(),
};
不過麻煩的是
要先知道他欄位
但是像我想要直接用CODE抓欄位的就........
還在找動態方式...
先紀錄一下!!!
沒有留言:
張貼留言