There is no "simple solution" - what you are trying to do is a complex process, even with pretty small data samples.
For example:
DataTable dt1 = new DataTable();
dt1.Columns.Add("ID");
dt1.Columns.Add("Name");
dt1.Rows.Add(1, "Fred");
dt1.Rows.Add(2, "Mark");
dt1.Rows.Add(3, "Michelle");
DataTable dt2 = new DataTable();
dt2.Columns.Add("ID");
dt2.Columns.Add("Age");
dt2.Rows.Add(1, "23");
dt2.Rows.Add(2, "23");
dt2.Rows.Add(3, "25");
var result = from d1 in dt1.AsEnumerable()
join d2 in dt2.AsEnumerable() on d1["ID"] equals d2["ID"]
select new
{
Id = d1["ID"],
Name = d1["Name"],
Age = d2["Age"]
};
DataTable dt3 = result.ToList().ToDataTable();
Creates two (related) data tables, and uses Linq and an extension method to generate a combined table.
(The extension method is available here:
Converting a List to a DataTable[
^])
But this is dependant on the two tables having related information. When you are dealing with separate DataSets which will likely have multiple tables in each, it becomes even more complicated.
If possible it would be better to do this at the data source - your database for example.