Delete rows from datatable based on another datatable

adwaitjoshi

Active member
Joined
Dec 29, 2005
Messages
38
Programming Experience
1-3
I have one datatable say DataTable1 that has some rows of data. DataTable2 also has some rows of data (less than or equal to DataTable1 rows). I need to delete those rows from DataTable1 which are already present in DataTable2 is there a simple way to do that?
 
If this is a one-shot deal, I would tackle it this way:
Load all records in table2 and set up a loop.
for i = 0 to (number of records for table2),
get the key value from table2 record,
query table1 for a matching record,
if (number of records for table1) > 0 then
remove record from table 1
else
do nothing
end if
next i

There are definately other ways to accomplish this task, this is just one quick way.
 
Back
Top