Home > Code > C# > How to Sort Dataset using DataView in C#.NET?

How to Sort Dataset using DataView in C#.NET?

by Thamil   on Jun 13, 2011   Category: C#   |  Views: 6740    |  Points: 25   |  Gold 



Once dataset is binded with grid view, we may have to use the dataset records for another purpose. If you want sort the records from DataSet, see the below simple code snippet to sort records using dataview.
DataView dv  = ds.Tables[0].DefaultView; // DataSet to DataView 
dv.Sort = "Name Desc"; // We can able to add more columns in this
DataTable dt = dv.Table; // DataView to DataTable





Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts