What is the easiest way to check if some rows exists in another datatable.
Example:
dt1:
After processing the datatable should look like this: dt2:
Sometimes after the processing has finished dt2 can look like this:
The “Result” column contains the value of “Bad” but is not from the original datatable(dt1)
I need to check rows that contains the value “Bad” in dt1 so that it doesnt appear again in dt2.
If dt2 has a row that contains the value of “Bad” but isnt exactly the same as in dt1 then it is OK.
But if the rows with the value “Bad” in dt1 also is present in dt2 then I need to handle it, it is not OK.
@ppr I think I found a problem. In your example xaml
If dtData1 contains two rows that are exactly the same the dt1Common doesnt handle duplicates.
When I tested with the values I have, my dtData1 has 93 rows and dt1Common should also contain 93 rows.
dt1:
This is a totally valid datatable in my process.
After some actions by the system the datatable that i download(excel) should look like this: dt2:
The rows with the value “Bad” from dt1 needs to be gone in dt2 for the process to continue otherwise I throw an error in my REF process.
Because the process takes up to 15 min to finish and during that time when i download the excelfile again(dt2) it could contain values with “bad” that are totally different from the first datatable(dt1).
The only thing i want to check is if the rows with the “bad” values from dt1 are gone,
If the rows with the “bad” value in dt1 are gone in dt2 then everything is fine and the process can continue.
Hope this explains it better otherwise I will try again
Need to iterate it in a loop and then give it in if condition this will resolve the issuue.
As desired value is comming from a loop of table it will be dynamic.
For example
For item in dt1:
In If condition DT2.AsEnumerable().Any(Function(x) x(“Column1”).ToString = item.tostring)
Then codition