How to change the data type of a column in data table

Hi Guys,

I want to know how to change the data type of a column in data table.

I have Read CSV activity which gives an DataTable output, later i have to sort this data table based on Line numbers.

As the default data type is String, no proper sort. i need to some how convert this line number column as Int so that sort applies correctly.

Regards,
Achyuth

Try if this works for you:
table.AsEnumerable().OrderBy(Function ( r) Convert.ToInt(r(firstColumn).ToString()))

Hi RonLobo,

I dint get a chance to use what you suggested, mean while this fixed the problem.
Used the following in the Assign activity.

dt = (From row In dt.Select Order By Convert.ToInt32(row(“PRLINENUM”)) Ascending Select row).ToArray.CopyToDatatable()

1 Like

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