本文转载自:http://www.cnblogs.com/sydeveloper/archive/2013/03/29/2988669.html 1.用两层循环计算,前提条件是数据已经按分组的列排好序的. DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[] { new DataColumn("name", typeof(string)), new DataColumn("sex",…
通过linq查询datatable数据集合满足条件的数据集 1.首先定义查询字段的变量,比方深度 string strDepth=查询深度的值: var dataRows = from datarow in dataTable(须要查询的datatable数据集).AsEnumerable() where string.Compare(datarow.Field<string>(…
using System.Web.Script.Serialization; using System.Collections.Generic; using System.Reflection; using System.Data; using System; namespace CommonCode { public class Common { /// <summary> /// LINQ返回DataTable类型 /// </summary> public static Da…