Merge DataTable by column ID

Hi!
I have two datatable DT1 and DT2.
In this datatables is column ID
In DT1 in ID from 1 to 100, and in DT2 in ID from 1 to 30
And I must get DT3 with ID from 31 to 100
Activity Join DataTable not help me

So dt3 is the exact same as dt1, it just removes all rows where dt1.ID = dt2.ID Is that correct?

Here is an example from the forums showing one way to perform that operation using LINQ: How to delete data row of one data table based on other matching data row of other datatable? - #7 by samir

and how write this linq?

@Aleksey_M did you look at the link I sent and look at the .xaml that was posted? If so, what questions did you have about that example?

there is a slightly different task
I didn’t understand how to apply this link to my task.

Which part are you struggling with? Isn’t the example in the post exactly what you’re trying to do? Do the screenshots make sense? If not, what is different between that post and yours?

The more information you provide, the better the help you’ll receive

My task is simle:
First DT1 have this records in column ID:
1
2
3
4

100
Second DT2 have this records in column ID:
1
2
3
4

30
And itog in DT3 must be:
31
32
32

100
Only those records from DT1 that are not in DT2

Could you please help me understand why that post doesn’t apply? To me, it looks to be exactly the same scenario

It work, thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.