I am trying to change a column’s data type to double by using .NET code something similar below but which doesn’t sort it additionally. Plus the code below gives me the error as
“Assign: Input string was not in a correct format.”
The code that I am using:
(From row In dtTest.Select Order By Convert.ToDouble(row(“ASP”)) Descending Select row).ToArray.CopyToDatatable()
If you have other practical solution which doesn’t include for loop, they are welcome.
This doesnt really exists, it is not possible to change a datatable column type after it has data, so every solution that works will involve to create a new datatable with that column changed and copying every row, converting that one to the new, so all commands you use will have loops (even tho they dont look like they do). So the fastest solution will always simply create the new datatable and in a loop use add datarow, but if you prefer to do it in one line instead, then is a choice too.