DataSet sorting

2019-02-22 05:55发布

In DataTable I could sorting with

 dataTable.DefaultView.Sort = "SortField DESC";

I'm getting a DataSet from database, I was wondering could I do a sorting on the DataSet like how I do it in DataTable.

7条回答
霸刀☆藐视天下
2楼-- · 2019-02-22 06:46
 DataSet fileTransferDetail = null;//Data to be sorted.
 DataSet result = null;//Declare a dataSet to be filled.

//Sort data.
fileTransferDetail.Tables[0].DefaultView.Sort = "ID DESC";
//Store in new Dataset
result.Tables.Add(fileTransferDetail.Tables[0].DefaultView.ToTable());
查看更多
登录 后发表回答