Unable to do operations with data row

Hi All, I want to perform a task with data I have. I have a excel and its called as database. We have a one column called “Deal ID”, which has duplicates. I have another data table(we can call this as outputdt) where we have same column as “Deal ID” without duplicates.

If Deal ID from outputdt is matched with Deal ID in database, I have to add the entire row from database to new datatable and remove the row in database.
Database:
image
outputdt:
image

Logic I added:

Please let me know how can I do this.

Thank you.

@Murthy_Desineedi_Radhakri

Manipulating same datatable inside a loop is not possible…instead you need to use filter datatable or a linq query

Use assign with

Dt = database.AsEnumerable.Where(function(x) outputdt.AsEnumerable.Any(function(y) y("ColName").ToString.Trim.Equals(x("ColName").ToString))).CopyToDataTable

To remove from datatbase use the below

database = database.AsEnumerable.Where(function(x) Not outputdt.AsEnumerable.Any(function(y) y("ColName").ToString.Trim.Equals(x("ColName").ToString))).CopyToDataTable

Cheers