Removing Rows from a datatable where the Value is in an array

Hi, I have an Comma Separated string and I’m looking to remove any rows from a datatable where a column value is equal to one of the items in the string.

I can get it working if I’m looking to keep the columns, but don’t know how to do it if I want to remove the columns.

I’m using this:

(From r In dt.AsEnumerable From s In Variable.split(","C) Where not r(ColumnName).toString.contains(s) Select r).CopyToDataTable

But it doesn’t give me the desired result.

As an example

If Variable = “Tim,Tom,John”

and my Datatable is

FirstName
Tim
Tom
Tim
John
Chris
Jim

I would expect:

FirstName
Chris
Jim

Any help is greatly appreciated! Thanks

Hi,
Check this Solution Delete data row from data table - #86 by aksh1yadav

@cwedl
find some starter help here:
Filter_1Col_ByNotInSearchTermArray.xaml (7.3 KB)

1 Like

Thanks but that doesn’t really help me, I was hoping someone could see what was wrong with my code.

Thanks PPR exactly what I needed!

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