Linq to DataTable 操作
2016-09-01 17:46
375 查看
--- 绑定显示列表 private void BindList() { DataTable dt = dal.GetList(""); // GetList("") 方法从数据库读取并返回DataTable对象集合 string args = ""; //查询参数 if (!string.IsNullOrEmpty(this.txtvalue.Text)) // 判断文本框输入查询条件 { args = this.txtvalue.Text.ToString(); } var vdt = from temp in dt.AsEnumerable() // linq语句 where temp["CompanyName"].ToString().StartsWith(args) select new { // 集合列表Eval()方法绑定的显示字段; Comid = temp["Comid"].ToString(), CompanyName = temp["CompanyName"].ToString(), NCID = temp["NCID"].ToString(), CreateDate = temp["CreateDate"].ToString(), Phone = temp["Phone"].ToString() }; this.Repeater1.DataSource = vdt; this.Repeater1.DataBind(); }----以上的操作完全在aspx.cs的前台页面中的后台页面中书写的,但我不清楚到底在前台写linq绑定号还是在 dal数据层写好.欢迎各位dX歇息
相关文章推荐
- LINQ to DataSet的DataTable操作
- LINQ系列:LINQ to DataSet的DataTable操作
- LINQ系列:LINQ to DataSet的DataTable操作
- LINQ系列:LINQ to DataSet的DataTable操作
- C# LINQ系列:LINQ to DataSet的DataTable操作 及 DataTable与Linq相互转换
- LINQ系列:LINQ to DataSet的DataTable操作
- LINQ TO DATATABLE/DATASET基本操作之-简单查询
- LINQ系列:LINQ to DataSet的DataTable操作
- LINQ系列:LINQ to DataSet的DataTable操作
- LINQ系列:LINQ to DataSet的DataTable操作
- Linq&Lumda---LINQ to DataSet的DataTable操作
- LINQ to DataSet的DataTable操作
- Linq to datatable 操作
- LINQ to DataSet的DataTable操作
- LINQ to XML 操作XML文档
- LINQ to XML 操作XML文档
- WCF如何正确调用LINQ TO SQL--更新操作
- LINQ to XML 操作XML文档
- LINQ to XML 操作XML文档
- LINQ to SQL更新数据库操作