C#后台sql语句查询

错误:前台界面不显示员工姓名

_sql.Append(" SELECT e.FullName ,r.RoleName ");

 _sql.Append("FROM lhg_sys_base_role r ");

 _sql.Append("LEFT JOIN lhg_ehr_staff_rolemapping rm  ON r.PKID = rm.RoleID ");

_sql.Append("LEFT JOIN lhg_ehr_staff_employeeinfo e ON e.PKID = rm.EmployeeInfoID ");

原因:sql查询员工姓名属性未定义,与前台员工姓名属性名不对应

修改方法:

_sql.Append(" SELECT e.FullName as EmployeeName,r.RoleName ");

 _sql.Append("FROM lhg_sys_base_role r ");

_sql.Append("LEFT JOIN lhg_ehr_staff_rolemapping rm  ON r.PKID = rm.RoleID ");

_sql.Append("LEFT JOIN lhg_ehr_staff_employeeinfo e ON e.PKID = rm.EmployeeInfoID ");

你可能感兴趣的:(C#后台sql语句查询)