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 |
What is concurrency? How will you avoid concurrency when dealing with dataset? (One user deleted one row after that another user through his dataset was trying to update same row. What will happen? How will you avoid the problem?)
What are the Different layers in ADO.Net?
ADO and ADO.NET differences ?
What do you know about ado.net's methods?
Define isolation?
Explain how do you connect to sql server database without using sqlclient?
How to work with disconnected data - the dataset and sqldataadapter?
types of Store procedure in Sqlserver2000?
What is Data Provider?
What is sequence of code in retrieving data from database ?
3 Answers Accenture, BirlaSoft,
What is defaultview in datatable?
can u tell me the how to get the print for the form