DataTable根据字段排序

DataTable根据字段排序:

DataTable dt = new DataTable("StoreBaseDefault");
dt.Columns.Add(new DataColumn("StoreroomId",  typeof(string)));
dt.Columns.Add(new DataColumn("Price",  typeof(decimal)));
DataRow nr =dt.NewRow();
nr["StoreroomId"] = "001";
nr["Price"] = "39.88";
dt.Rows.Add(nr);
//根据Price排序
dt.DefaultView.Sort = "Price ASC";
dt= storeDefault.DefaultView.ToTable();

你可能感兴趣的:(ASP.NET,MVC,c#,mvc,.net)