N
Neil
I have 2 datatables called tableA and tableB. TableA and
TableB have a common field or column called IdentityID,
this field is not a primary key. I want find out if any
of the IdentityID's are not in tableB that are in tableA,
if they are then I want to delete the rows from tableA.
What is the best practice to do this?
I have tried doing a foreach loop through all the rows in
tableA, nesting another foreach loop inside the first to
check if the current row value for IdentityID is in
tableB. The problem is removing the rows because by doing
this I modify the collection and the foreach loop fails.
Even if I use the Delete method of the datarow which is
supposed to only mark the row for deletion this still
modifies the collection.
My work around has been to create a third table with only
the rows from tableA that are also in tableB but I don't
think this is the best way....?
TableB have a common field or column called IdentityID,
this field is not a primary key. I want find out if any
of the IdentityID's are not in tableB that are in tableA,
if they are then I want to delete the rows from tableA.
What is the best practice to do this?
I have tried doing a foreach loop through all the rows in
tableA, nesting another foreach loop inside the first to
check if the current row value for IdentityID is in
tableB. The problem is removing the rows because by doing
this I modify the collection and the foreach loop fails.
Even if I use the Delete method of the datarow which is
supposed to only mark the row for deletion this still
modifies the collection.
My work around has been to create a third table with only
the rows from tableA that are also in tableB but I don't
think this is the best way....?