So, I'm attempting to create search exclude functionality on a data table.
I've tried a few things, both the Select() method and I also tried LINQ.
I tried to build a CHARINDEX Select() method function that looked something like:
dt.Select("CHARINDEX (" + searchString + ")");
But it kept throwing formatting errors.
And I tried LINQ with something like:
var filtered = dt.AsEnumerable()
.Where(r => !r.Field<String>(col).Contains(searchString));
But in the end I'm getting the entire table returned to me and for the life of me I can't figure out why.
I'd prefer to get the LINQ version of the solution working because I've been told that searching Data Tables with LINQ is more efficient than the Select() method.
Thank you for all of your help.