ray_sha
December 6, 2019, 8:33am
#1
Hey,
I want to sort a column in a csv file with more then one condition used for sorting.
So I used the below code.
(From x In datatablevariable.AsEnumerable() Order By convert.ToInt32(x("Column Name ")),convert.ToString(x("Column Name ")) Select x).CopyToDataTable
But this gives it in ascending order.
I want to apply the seconding condition and get the output in descending Order
Thanks in Advance!
TimK
(Tim Kok)
December 6, 2019, 9:00am
#2
You need to add the descending operator
(From x In datatablevariable.AsEnumerable() Order By convert.ToInt32(x("Column Name ")),convert.ToString(x("Column Name ")) Descending Select x).CopyToDataTable
Also have a look at this site for more learning.
1 Like
ray_sha
December 6, 2019, 9:13am
#3
Hey @TimK
worked well!
Thanks for sharing the link and for replying!
1 Like
TimK
(Tim Kok)
December 6, 2019, 9:15am
#4
No problem Happy learning haha
system
(system)
closed
December 9, 2019, 9:15am
#5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.