日期:2014-05-17 浏览次数:20730 次
DataTable dtable = new DataTable();
dtable.Columns.Add("name",typeof(string));
dtable.Columns.Add("oid", typeof(int));
dtable.Columns.Add("money", typeof(int));
dtable.Rows.Add(new object[] { "A", 1, 10 });
dtable.Rows.Add(new object[] { "B", 1, 10 });
dtable.Rows.Add(new object[] { "C", 1, 10 });
dtable.Rows.Add(new object[] { "D", 1, 10 });
dtable.Rows.Add(new object[] { "A", 2, 20 });
dtable.Rows.Add(new object[] { "C", 3, 10 });
var dtquery = from dt in dtable.AsEnumerable()
group dt by dt.Field<int>("oid") into g
select new
{