Adds

Wednesday, 11 December 2013

join three tables using linq in c#

How to use Join Query in ASP.NET C# LINQ.

 var res = (from x in dbcon.tblEmployeeCommissions
                       join y in dbcon.tblClientRegistrations on x.ClientID equals y.ClientID
                       join z in dbcon.tblEmployees on x.EmployeeID equals z.EmployeeSlNo
                       where z.COPID == txtCoOperativePersonID.Text
                       select new {
                       x.CommissionDate,
                       y.ClientCode,
                       x.FA,
                       x.UM,
                       x.CO});

            gvCommissionDetails.DataSource = res;
            gvCommissionDetails.DataBind();

In the above code.  "gvCommissionDetails" is my GridView Name.