DataTable dt = new DataTable(); dt.Columns.Add("Column_1", typeof (string)); dt.Columns.Add("Column_2", typeof (string)); dt.Columns.Add("Column_3", typeof (string)); dt.Rows.Add("1", "二", "C"); dt.Rows.Add("2", "三", "A"); dt.Rows.Add("3", "一", "B"); dt.DefaultView.Sort = "Column_1 DESC"; dataGridView1.DataSource = dt;
dt.DefaultView.sort = "AG DESC"; dt = dt.DefaultView.ToTable(); //將排序好的 DefaultView 產出新的DataTable 或是複寫回去。
ref:
https://social.msdn.microsoft.com/Forums/zh-TW/07dda425-e1b7-4202-8fca-31c3c31a0159/datatable-?forum=233
clifton@mail.postmanllc.net
回覆刪除Thank you for your post. Hawkscode Uk is the leading IT service provider. Hawkscode Uk
回覆刪除is web development company.