Putiing DataTable into an Array

Hi everyone,

i am trying to put information from my DataTable into an array. I am filtering the DataTabel until there is only one Column left. Each Column is a String value. I now want to put each String Value into one index of an array. I just can’t figure out how.
Thanks for the Help!

Use YourColumnString.Split(" ") in an Assign Activity which populates an array variable for each column

Hi @Robin112

Please find below methods.

Count = 0
For each row in Datatable
ListValues[Count ] = row(0).tostring
Count = Count + 1

ListValues is of List type.


List(of string) = (From row in InputDT.AsEnumerable() Select Convert.Tostring(row(“ColumnName”))).ToList()

Please change column name with your data table column name or use index of the column.



I am getting an error which tells me that i cant convert String to char when doing this

but this will give me a List right!? I need an array

Apologies, this is the way to handle the char->string conversion

YourColumnString.Split(" "c)

Hey @Robin112

is your data has fixed size ??
Because arrays will allow you to store some fixed number of elements only. The benefit of List is that you can store any number of values at a time.

That is the reason i gave solution with List.

Can you please be more specific why you need only array ???


ViJay, you asked about my preference for an array.
When processing at table from the sqlserver,
I need to know when I am at the last row for my user.
So, on the current row, I need to compare the username on the current row,
to the user name on the next row.
an array would make this possible.
p.s. Maybe you have a way to do this comparison?