Count is similar names present in the list and save it as datatable

Continuing the discussion from Linq Query to get the count of a value in particular column of datatable:

What if the string “inv002” is dynamic?

I.e we have a list and “inv002” is a part of that list??

HI @Ray_Sha1

Try this instead of the above

(Function(r) r("Invoice Number").ToString.ToUpper="INV002")


It is about use upper keyword…
Suppose it’s dynamic, taken from a list

@Yoichi, can this be accomplished in dynamic order?


If your requirement is filter datatable with items of your list, the following will work.

yourList = New List(Of String)From{"A","B"}


dt.AsEnumerable.Where(Function(r) yourList.Contains(r("Invoice Number").ToString)).CopyToDataTable

If the above isn’t what you expect, can you elaborate with specific sample?


what kind of list Can you share the Input and expected output? @Ray_Sha1