Sorting of one column in a CSV file in descending Order with more then one condition used for sorting

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!

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

Hey @TimK
worked well!
Thanks for sharing the link and for replying!

1 Like

No problem :slight_smile: Happy learning haha

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.