I am currently working with a Datatable with “n” number of columns, I would like to be able to concatenate the value found in the cells of the columns for each row to be written in new rows in a datatable. Any suggestions on how I can do these concatenations since the number of columns can vary?
A LINQ along With the itemarray from datarow could Help
CanOu Share some sample data with us?
Hi @JavXult ,
Sample Data would be most appreciated as it would put us in a better position to assist you.
If you simply wish to concatenate all the row items into a single column, then this ought to do the trick:
(From row In dt_sampleData.AsEnumerable()
Let ra = String.Join(",",row.ItemArray)
Select dt_result.Rows.Add(new object(){ra})).CopyToDataTable()
ConcatenateColumnValues.xaml (9.1 KB)
Kind Regards,
Ashwin A.K
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.