locked
programming help RRS feed

  • Question

  • how do you join more than two tables using "LAMDA"?
    Tuesday, May 20, 2014 8:43 AM

Answers

  • I was trying to convert something like this to VBnet over the wekend but wasn't successful.  I thinnk it should work in C#.

                DataSet ds = new DataSet();
                var combinedData = from t0 in ds.Tables[0].AsEnumerable()
                    join t1 in ds.Tables[1].AsEnumerable()
                    on t0.Field<string>("id") equals t1.Field<string>("id")
                    join t2 in ds.Tables[2].AsEnumerable()
                    on t0.Field<string>("id") equals t2.Field<string>("id")
                    into grp1
                    from tb3 in grp1.DefaultIfEmpty()
                    select new {
                        ID = t0.Field<string>("id")
                    };


    jdweng

    Tuesday, May 20, 2014 9:49 AM