This time, we need to sort not only the value of “ColumnName1”, but also the value of the column named “ColumnName2”. The image is as follows.
OrderBy ColumnName1 ASC, ColumnName2 ASC
At first, I used DataView, but the values of ColumnName1 and ColumnName2 are numbers, String type. so they are sorted by the first digit as 1, 10, 100.
Therefore, I need to add ColumnName2 as a number to the syntax written above, and add it as the ASC of the second name preference, but I don’t know how to do it.
(From d in dt.AsEnumerable
Let k1 = If(Information.IsNumeric(r("columnName1")), CDbl(r("columnName1")), 0)
Let k2 = If(Information.IsNumeric(r("columnName2")), CDbl(r("columnName2")), 0)
Order By k1, k2
Select r=d).CopyToDataTable()