Tim Johnson
Tim Johnson

Reputation: 81

Return all columns in anonymous linq join

How do I return all the columns in the following anonymous linq join:

var results = (from t in Table1.AsEnumerable() join t2 in Table2.AsEnumerable()
                on t.Field<string>("id") equals t2.Field<string>("id")
                into allcol from rows in allcol
                select rows);

I am getting allow rows from Table2, and no rows from Table1

Upvotes: 0

Views: 5067

Answers (1)

yo chauhan
yo chauhan

Reputation: 12315

var results = (from t in Table1.AsEnumerable() 
                           join t2 in Table2.AsEnumerable()
                           on t.Field<string>("id")
                           equals t2.Field<string>("id")
                           into allcol
                           from rows in allcol
                           select new {table1=t,table2=rows});

I hope this will help.

Upvotes: 1

Related Questions