The first data table having master data and the second table having the needed data id, and while comparing i need to delete the rows form the first table , which is not there in 2nd table, i am trying to use linq,
NO | Name | Position | Group |
---|---|---|---|
1 | John | Painter | India |
2 | MArk | Washer | India |
3 | Peter | Officer | Nepal |
4 | Angel | Officer | India |
5 | Bibin | Washer | Nepal |
6 | Jerry | Painter | Nepal |
DataTable 1:
NO |
---|
1 |
2 |
3 |
Datatable 2:
Result Table
NO | Name | Position | Group |
---|---|---|---|
1 | John | Painter | India |
2 | MArk | Washer | India |
3 | Peter | Officer | Nepal |
i try this query
var qry1 = datatable1.AsEnumerable().Select(a => new { NO.ToString() });
var qry2 = datatable2.AsEnumerable().Select(b => new { NO.ToString() });
var newTable = qry1.Except(qry2);
but i gets the rows which are not there.
many process i tried to get the result,