How to add multiple columns in a Data Table along with column's data type

Hi.
Is it possible to add more than 100 columns in a data table along with its data type? Is there any specific activity for that? I got stuck while using the “Build Data Table” activity where in I have to create 100 columns with different data type.

Thank You.

Hi @Chendoran_M

If you want to cast to some specific datatype…then do one thing…Create a table in excel with column headers and then one row with values with the same datatype as you need and then read range and remove the row

cheers

Hi,

We can use DataColumnCollection.AddRange method as the following.

dt = New DataTable()
arrColName = {"A" , "B"}
arrColType = {"System.String","System.Int32"}

Then

dt.Columns.AddRange(arrColName.Zip(arrColType,Function(n,t) New DataColumn(n,Type.GetType(t))).ToArray)

Sequence1.xaml (6.9 KB)

Regards,

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