Hi, i was lookig for some help with copying values for a datatable column in to an existing list. When i try the following it just overwrites the values in the list ( From row in dt.AsEnumerable() Select Convert.Tostring(row(“ColumnName”)) ) .ToList.Copy
How can i simply append without using a loop?
Thanks
ppr
(Peter)
April 19, 2023, 11:24am
2
dtList = dt.AsEnumerable().Select(Function (x) x("ColumnName").toString.Trim).toList
newList = oldList.Concat(dtList).toList
@ppr [quote=“ppr, post:2, topic:537242”]
dt.AsEnumerable().Select(Function (x) row("ColumnName").toString.Trim).toList
newList = oldList.Concat(dtList).toList
[/quote]
Thank you for your quick reply. when i try to use, i recieve the error ‘row is not declared’. Could you help please?
Hi @qwerty1 ,
In addition to @ppr method, you can also use invoke method to add to the list as shown below using the AddRange function:
Pass your expression in the parameters.
Regards,
1 Like
ppr
(Peter)
April 19, 2023, 11:39am
6
qwerty1:
row is not declared
did correct the statement in origin post above
1 Like
system
(system)
Closed
April 22, 2023, 11:39am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.