I have two data tables, Datatable1 and Datatable2. Datatable1 is subset of the other. I want to find out which rows are new, which of them are matching and which of them non-matching. Want to add a new row in Datatable1 with values - new, matching, and non-matching. Please suggest an optimized way to do this.
For Example: Datatable1:
DataTable table = new DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name1", typeof(string));
table.Columns.Add("Name2", typeof(string));
//New
table.Rows.Add(25, "Ciya", "David");
table.Rows.Add(51, "Kiya", "Cecil");
//Matching
table.Rows.Add(50, "Bina", "Cecil");
//Non matching
table.Rows.Add(21, "Riya", "Janet");
table.Rows.Add(10, "Rita", "Christoff");
Datatable2:
DataTable table = new DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name1", typeof(string));
table.Columns.Add("Name2", typeof(string));
table.Rows.Add(10, "Lisa", "Christoff");
table.Rows.Add(21, "Combivent", "Janet");
table.Rows.Add(50, "Bina", "Cecil");