摘要: 编辑行: protected void gvCategoryList_RowEditing(object sender, GridViewEditEventArgs e) { gvCategoryList.EditIndex = e.NewEditIndex; gvAdminBind(); }取消编辑行: protected void gvCategoryList_RowCancelingEdit... 阅读全文
posted @ 2009-05-26 13:59 失落的狼崽 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 在显视页: public void gvNewOBind() { int P_Int_returnValue = mcObj.IsExistsNI("Proc_GetNOI"); if (P_Int_returnValue == -100) { } else { SqlCommand myCmd = mcObj.GetNewICmd("Proc_GetNOI"); mcObj.gvBind(gv... 阅读全文
posted @ 2009-05-26 12:13 失落的狼崽 阅读(562) 评论(0) 推荐(0) 编辑
摘要: 使用ToList或者是ToArray [ə'rei]来将查询结果转换成集合或者数组。使用查询语句查询结果的时候,实际上并没有真正操作数据库,这里是运用的延迟加载的机制,如果不希望使用延迟加载,而是需要立刻知道查询的结果时,使用ToList或者是ToArray便可以做到。下面我们示例一下他们的用法 DataClasses2DataContext db = new DataClasses2Data... 阅读全文
posted @ 2009-05-03 10:42 失落的狼崽 阅读(691) 评论(0) 推荐(0) 编辑
摘要: private void GroupJoinQuery() { ///构建数据源 List users = new List(); List roles = new List(); for (int i = 1; i 0 ? v.Roles[0].RoleName : string.Empty) + ""); ... 阅读全文
posted @ 2009-05-03 10:41 失落的狼崽 阅读(219) 评论(0) 推荐(0) 编辑
摘要: private void InnerJoinQuery() { ///构建数据源 List users = new List(); List roles = new List(); for (int i = 1; i < 10; i++) { users.Add(new User... 阅读全文
posted @ 2009-05-03 10:39 失落的狼崽 阅读(138) 评论(0) 推荐(0) 编辑
摘要: private void MultiFromQuery() { ///构建数据源 List ausers = new List(); List busers = new List(); for (int i = 1; i 5 select new {au.Username, bu... 阅读全文
posted @ 2009-05-03 10:37 失落的狼崽 阅读(214) 评论(1) 推荐(0) 编辑
摘要: private void LambdaQuery() { ///构建数据源 int[] ints = new int[100]; for (int i = 0; i i+1).Distinct(); ///显示查询结果 foreach (var v in values) { ... 阅读全文
posted @ 2009-04-28 11:30 失落的狼崽 阅读(124) 评论(0) 推荐(0) 编辑
摘要: using System.Collections.Generic; private void CollectionInitUserInfo() { ///初始化users列表 List users = new List(); for (int i = 1; i {"ASP.NET" + i.ToString().PadLeft(3,'0')} ... 阅读全文
posted @ 2009-04-28 11:28 失落的狼崽 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 创建一个匿名类型对象 var role = new { ID = 1, RoleName = "Admin" }; ///显示role的RoleName属性的值 Response.Write(role.RoleName + ""); var关键词,在声明局部变量时可用于替代类型名。var这个关键词而是告诉编译器在变量最先声明时,从用来初始化变量的表达式推断出变量的类型。 ... 阅读全文
posted @ 2009-04-28 11:22 失落的狼崽 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Lambda表达式 //x的类型省略了,编译器可以根据上下文推断出来,后面跟着的是表达式 x => x+1 deleage(int x){return x+1;} //后面跟着的是语句块 x=>{return x+1;} delegate(int x){return x+1;} //输入参数也可以带类型,带类型后别忘记小括号哦 (int x) => x+1 delegate(int x){r... 阅读全文
posted @ 2009-04-28 11:13 失落的狼崽 阅读(177) 评论(0) 推荐(0) 编辑