I am in the process of learning LINQ and with searching forums have come up with the following query to try and remove rows from a data table based on the values from two columns.
in_Dt = in_Dt.AsEnumerable().where(Function(x) Not (x("Location")).Equals(row("Location").ToString) And Not (x("Date").ToString).Equals(row("Date").toString).CopyToDataTable
This above code is being run in a for each row loop and the row(“Location”) and row(“Date”) are from a datatable with rows combinations that should be removed from my larger table.
But this isn’t functioning as I intended. It is removing all the rows with the values of that location, not just the values of that specific location+date combined. I only want rows with that certain combination of both date and location to be removed, leaving any combinations of that location+other dates.
If someone could help me arrange this so that it takes both columns into consideration when removing a row that would be greatly appreciated! Thank you all!
Here is a quick example table of what I am expecting