Sorting on 2 columns of DataTable

Peter King

Member
Joined
Sep 11, 2006
Messages
15
Programming Experience
Beginner
Hi, there

It seems to be simple, but still it got me mad.

I have a DataTable with several columns. The first two columns are strings. I want to sort the table by the substring(0,1) of the first column and then by the substring(0,1) of the 2nd column. Anyone can help?
 
make another column, append the values to it, then sort it

if the data is coming out of a database, have the database do the sorting, or have the database rpoduce a column you can sort on
 
Hi, cjard

Thank you very much for the help.

Yes, adding another column is a solution. However, I prefer not adding a column just for the sorting purpose. Is there an alternative such as generating a new DataView which can be be used to bind to a DataGridView?

P
 
Hi, cjard

Thank you very much for the help. I have read the website you suggested about expressions. It seems to me there is no easy solution from there. Therefore, I followed your previous advice and add an aditional column.

Thnaks again.

P
 
Back
Top