Put data of column datatable in one string variable

Hi everybody,

I have a little question about getting values from a column of a datatable in one string.
When i have a column like this:

abc
def
ghi
jkl

I want this in one string variable like this:
abc,def,ghi,jkl

This column can be dynamic, so it can be a column like this:
abc
def
ghi

I’m struggling with list of strings or in for each from datatable.

You can loop through the data table and form that particular column as a string by concatenating the values one after the other @hansgeeroms

Hi Greetings!

dataTable.AsEnumerable().[Select](Function(x) x(“Column1”).ToString()).Aggregate(Function(a, b) String.Concat(a, “,” & b))

Please try this…!

Thanks!

2 Likes

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