0

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

1 Answer 1

1
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.

2
  • Does this return a single data set or two different datasets? When i viewed this in the debugger, it seemed to separate them out? Mar 5, 2013 at 15:48
  • yes you need to iterate through and convert them to specific type from anonymous type.
    – yo chauhan
    Mar 5, 2013 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.