摘要: DataTable dt = (from x in dsResult.Tables[0].AsEnumerable() where DataTrans.CBoolean(x["IsChecked"]) == true group x by new { no = x.Field<string>("NO 阅读全文
posted @ 2015-10-15 14:04 海角之上 阅读(361) 评论(0) 推荐(0)
摘要: 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失掉每个Category 阅读全文
posted @ 2015-10-15 13:58 海角之上 阅读(815) 评论(0) 推荐(0)
摘要: 本文是写给C#新手,老手就勿看了,讲的实际上就是LINQ,谢谢一楼的提醒。 很多时候,从一个关系表中挑出一个我们需要的元素列表采用SQL语句是再容易不过的了,其实C#的List中也可以采用类似的方法,虽然List中集成了Select(), Where()等语句,不过如果你的判断规则较为复杂,或者想要 阅读全文
posted @ 2015-10-15 13:47 海角之上 阅读(18128) 评论(0) 推荐(0)