joins:
ex1:var query = from myemp in dc.Emps
join mydept in dc.Depts on myemp.Dept_Id equals mydept.DeptId
join myDesig in dc.Desigs on myemp.Desig_Id equals myDesig.DesigId
select new
{
EmpName = myemp.EmpName,
EmpPhone = myemp.EmpPhone,
Photo = myemp.Photo,
DeptName = mydept.DeptName,
DesigName = myDesig.DesigName,
Salary = myemp.Salary
};
Gv_data.DataSource = query;
Gv_data.DataBind();
type2:
var query = dc.Emps
.Join(dc.Depts, emp => emp.Dept_Id, dept => dept.DeptId,
(emp, dept) => new { emp.EmpName, emp.EmpPhone, emp.Photo,
dept.DeptName, emp.Salary })
.Join(dc.Desigs, emp => emp.Desig_Id, desig => desig.DesigId,
(emp, desig) => new { desig.DesigName });
Gv_data.DataSource = query;
Gv_data.DataBind();
No comments:
Post a Comment