.net 流氓
天下无难事,有志者成之;天下无易事,有恒者得之。
摘要: 用户控件调用父页面的方法://获得父页面Pagep=this.Parent.Page;TypepageType=p.GetType();//父页面的方法名MethodInfomi=pageType.GetMethod("Loading");//执行mi.Invoke(p,newobject[]{"参数1","参数2"});用户控件与用户控件之间调用://获得父页面Pagep=this.Parent.Page;//获得父页面的子控件UserControluc=p.FindControl("tj_ReceiptList2&quo 阅读全文
posted @ 2011-06-08 15:08 .net 流氓 阅读(1911) 评论(0) 推荐(1) 编辑
摘要: 描述:根据顾客的国家分组,查询顾客数大于5的国家名和顾客数查询句法:var 一般分组 = from c in ctx.Customersgroup c by c.Country into gwhere g.Count() > 5orderby g.Count() descendingselect new{国家 = g.Key,顾客数 = g.Count()};对应SQL:SELECT [t1].[Country], [t1].[value3] AS [顾客数]FROM (SELECT COUNT(*) AS [value], COUNT(*) AS [value2], COUNT(*) 阅读全文
posted @ 2011-06-08 11:27 .net 流氓 阅读(2784) 评论(0) 推荐(0) 编辑
摘要: 学习Linq时,经常会遇到Linq使用Group By问题,这里将介绍Linq使用Group By问题的解决方法。1.计数varq= frompindb.Products grouppbyp.CategoryIDintog selectnew{ g.Key, NumProducts=g.Count() };语句描述:Linq使用Group By和Count得到每个CategoryID中产品的数量。说明:先按CategoryID归类,取出CategoryID值和各个分类产品的数量。2.带条件计数varq= frompindb.Products grouppbyp.CategoryIDintog 阅读全文
posted @ 2011-06-08 11:08 .net 流氓 阅读(2809) 评论(0) 推荐(1) 编辑
摘要: 1.简单形式:var q = from p in db.Products group p by p.CategoryID into g select g; 语句描述:Linq使用Group By按CategoryID划分产品。说明:from p in db.Products 表示从表中将产品对象取出来。group p by p.CategoryID into g表示对p按CategoryID字段归类。其结果命名为g,一旦重新命名,p的作用域就结束了,所以,最后select时,只能select g。2.最大值var q = from p in db.Products group p by p.C 阅读全文
posted @ 2011-06-08 10:58 .net 流氓 阅读(59731) 评论(3) 推荐(7) 编辑