How to sort the data in Datatable
Answers were Sorted based on User's Feedback
Answer / kamalakannan.a
I think the above answer is correct.Another one method is
DataTable dt=new DataTable();
DataRow[] dr=dt.Select("Filter Expression","Sort
expression");
Here Sort expression is , for eg.Address is one of the
field in dt.
Then DataRow[] dr=dt.Select("","Address ASC");
But in this method is have the Datarow array.So you can use
another one method,I explain below.
DataView dv=new DataView(Datatable,Filter Exp,Sort
Exp,Dataviewrowstate)
Eg is
DataView dv=new DataView(dt,"","Address
ASC,DataViewVowState.CurrentRows);
Here we can copy this Dataview to datatable or use this
same dataview instead of datatable.
Kamal....
| Is This Answer Correct ? | 28 Yes | 3 No |
Answer / narayansahu
pass the datatable in dataview object and call the sort
method on dataview
dataview dv=new dataview(dt)
dv.sort
that's it
| Is This Answer Correct ? | 17 Yes | 17 No |
Difference between ADO and ADO.net ?
11 Answers Accenture, BirlaSoft, College School Exams Tests, Krest, Red Apple,
The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx
What are the steps you will take to improve performance? Will you use dataset or datareader?
How can I retrieve two tables of data at a time by using data reader?
FetCh Records No 5 to 10 From Dataset
i want 2 pass values(enterd in textbox)to table in sql server without using stored procedure in c#.plz tell me code with an example.
What is ado.net code?
What are typed and untyped dataset?
ADO and ADO.NET differences?
What is oledb connection?
What are the features of ado.net?
Compare Data Reader & Dataset in ado.net?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)