Datatable根据多行排序

            DataTable dt = new DataTable();
            dt.Columns.Add("ID", typeof(int));
            dt.Columns.Add("Name", typeof(string));

            dt.Rows.Add(new object[] { 12, "lwolf" });
            dt.Rows.Add(new object[] { 100,"kkkkk"});
            dt.Rows.Add(new object[] { 19,"jim" });
            dt.Rows.Add(new object[] { 1,"test" });

            DataTable dtCopy = dt.Copy();

            DataView dv = dt.DefaultView;
            dv.Sort = "ID";
            dtCopy = dv.ToTable();

可以根据多行排序

posted @ 2015-06-25 14:20  IT人生(正)  阅读(386)  评论(0编辑  收藏  举报