Error of type "Assign: Specified cast is not valid."

Hey All,

I’m trying to concatinate a number of values from an Excel spreadsheet, as such:
Column X
11111100011
222200022/30002022
300030033
and etc…

assign them to a single variable with the following output: 11111100011,222200022/30002022,300030033

But I keep getting the same “Specified cast” error when I use the following function:
String.Join(",",DataTable.AsEnumerable().Select(Function(a) a.Field(Of Double)(“Column X”)).ToArray())

The very same fucntion works if I target a column with consistent numbers which do not have any other elements (like: “/” or “,”).

Hi,

Can you try the following?

String.Join(",",DataTable.AsEnumerable().Select(Function(a) a("Column X").ToString()).ToArray())

Regards,

1 Like

Worked like a charm, thx :slightly_smiling_face:

1 Like

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