Convert array of String to array of DataColumn

Hi!

I was wondering if it’s possible to convert an array of String into an array of DataColumn in single line. I’m trying to do it like this:

arr_StringColumn.Select(Function(x) CType(x, DataColumn)).ToArray()

Thanks a lot!

Hi

Is it like u r trying convert array of Strings to a datatable with each string value in each column

@_pjflo

Hi @_pjflo ,

Could you let us know what is it that you want to perform ?

Are you trying to create a Datatable with Dynamic Number of Columns ?

@_pjflo

If you want to create dynamic columns in datatable using array of string then use generate datatable activity with input as string.join(",",Yourarray) and specify column separator as comma and check add headers or first line as header

Cheers

1 Like

Hi! I’m trying to use the Invoke Method - AddRange to add columns dynamically.

Hi @_pjflo ,

Try this:

StringArrayVariable.Select(function(x) new System.Data.DataColumn(x)).toarray()

Regards,

1 Like

It worked! Thanks for your help!

1 Like

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