Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends,
I am using the following code to sort and save the table on the raw data format. I don't want the table to sort for view only. I want to store it in ascending order.
MIDL
dSListofDrugs.Tables[0].DefaultView.Sort = "[Drugs] " + "asc";

this don't work for me.
Thanks for the help.
Posted
Comments
Thomas Krojer 26-Jan-11 10:46am    
rated 1 because you didn´t use google first. 30sec with google told me the error.
shakil0304003 26-Jan-11 23:55pm    
use google 1st.

Use this overload of DataTable.Select.

See http://msdn.microsoft.com/en-us/library/way3dy9w.aspx[^]

That will give a sorted array of DataRows, from which you can create a new data table.
 
Share this answer
 
v3
You might want to look at the DataView.Sort

See http://msdn.microsoft.com/en-us/library/69c06922(v=vs.71).aspx
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900