文章分类 -  Linq查询

摘要:1.计数var q = from p in db.Products group p by p.CategoryID into g select new { g.Key, NumProducts = g.Count() }; 语句描画:Linq运用Group By和Count失掉每个Cat... 阅读全文
posted @ 2015-09-05 20:45 清幽紫竹 阅读(120) 评论(0) 推荐(0)
摘要:1、左连接:var LeftJoin = from emp in ListOfEmployeesjoin dept in ListOfDepartmenton emp.DeptID equals dept.ID into JoinedEmpDeptfrom dept in JoinedEmpDept... 阅读全文
posted @ 2015-09-05 19:47 清幽紫竹 阅读(81) 评论(0) 推荐(0)
摘要:class ClientStruct { public string ID = "ID"; public string Name = "Name"; public string Company = "Co... 阅读全文
posted @ 2015-09-05 19:36 清幽紫竹 阅读(521) 评论(0) 推荐(0)
摘要:var re = from t in datatablegroup t by new {t.a,t.b,t.c,t.d} into gselect new {g.key,e=g.Sum(k => k.a)}; 阅读全文
posted @ 2015-08-28 18:28 清幽紫竹 阅读(98) 评论(0) 推荐(0)