DataTable 排序
DataTable newdtb = new DataTable(); newdtb.Columns.Add("Id", typeof(int)); newdtb.Columns.Add("ProName", typeof(string)); newdtb.Columns.Add("ProPrice", typeof(decimal)); newdtb.Columns["Id"].AutoIncrement = true; for (int i = 1; i < 11; i++) { DataRow newRow = newdtb.NewRow(); newRow["ProName"] = "pro" + i.ToString(); newRow["ProPrice"] = 12.3m; newdtb.Rows.Add(newRow); } newdtb.DefaultView.Sort = "id ASC, ProPrice desc"; DataTable dtTemp = dt.DefaultView.ToTable(); dtTemp 即按你需要排序的表。