Hi I’m trying to add values from column b from a datatable if the value in column a matches a specific value. I’ve used the below LINQ to filter and add to a list variable but only the first value of column b is added. Have tested with different values of column A, and ensure each distinct value in column a has two or more entries of different value in column b. Any and all advice greatly appreciated.
(From row In dataTable.AsEnumerable()
Where row.Field(Of String)(columnAName) Is specificValue
Select row.Field(Of String)(columnBName)).ToList()
Thanks for the prompt response. Your LINQ query returns an object instead of string. May I know which part of the query I could amend to change the return to be of string so it could fit into my list?