How to convert a Datatable variable to a Array Integer variable? Please help

I’m reading an excel of ticket numbers, next I’m trying to convert the DT_Input variable into an integer array Int32. However, I’m unable to complete this step. Please help!

I used the below 2 expressions which didn’t give out the expected outcome.

DT_Input.AsEnumerable().Select(Function (a)a(“Column Name”)).ToString).ToArray()

From row in DT_Input.AsEnumerable() Select Convert.ToString(row(“Column Name”)).ToArray()

@Jnana_S_Rao …please check this post …here i have made StringList…you just have to change it array and adjust it…

Thanks @prasath17 I’ll take a look at this one.

Have you tested to convert the strings to integers with CInt?

DT_Input.AsEnumerable().Select(Function (a) CInt(a("Column Name").ToString.Trim)).ToArray
4 Likes

Yes, it worked. Thank you so much!

2 Likes

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