8 April 2014

join three tables using linq in c#

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();

No comments:

Post a Comment