If you want to join data from different workbooks, the basic idea is here:
How to: Get Data from Multiple Workbooks using One OleDbConnection?[
^].
You did not provided a way you're fetching data into dataset. If it's a single workbook, you can use
OleDbConnection[
^] and
OleDbCommand[
^] to achieve that.
Proper query should looks like:
SELECT <FieldList>
FROM [Sheet1$] AS t1 INNER JOIN [Sheet2$] AS t2 ON t1.Field1 = t2.Field2
That's all.
[EDIT]
Please, see this:
Query Expression Syntax Examples: Join Operators (LINQ to DataSet)[
^]
var qry = from x in dtset.Tables(1).AsEnumerable() join y in dtset.Tables(2).AsEnumerable() on x.Field<Type>("Field1") equals y.Field<Type>("Field2")
select new {
NewField1 = x.Field<Type>(Field1),
NewField2 = x.Field<Type>(Field2),
NewField3 = y.Field<Type>(Field1),
NewField4 = y.Field<Type>(Field2)
};
foreach(var c in qry)
{
Console.WriteLine("{0} {1} {2} [3}", c.NewField1, c.NewField2, c.NewField3, c.NewField4);
}