我有一个带Project Name
和mkey
的查询。查询在
select
distinct
comp.company_name as 'Company',EMP.emp_name as 'Employee',
EMP.emp_card_no as 'Card_No',
EMP.mkey as 'Mkey',
isnull(hub.type_desc,'--NA--') as 'HUB_Name'
,isnull(Program_name,'--NA--') as 'Site',isnull(Project_name,'--NA--') as 'Project'
from emp_mst EMP
JOIN emp_mst1 PINFO ON EMP.MKEY=PINFO.MKEY
left join company_mst comp on EMP.comp_mkey=comp.mkey and fa_year=2008
left join type_mst_a b1 on EMP.New_Dept_mkey=b1.master_mkey --and b1.type_code='d11'
left join type_mst_a c1 on EMP.New_Subdept_mkey=c1.master_mkey-- and c1.type_code='d2'
left join type_mst_a d1 on EMP.new_design_mkey=d1.master_mkey --and d1.type_code='dm1'
left join type_mst_a e1 on EMP.ctc_hdr_mkey=e1.Add_IINFo1 and e1.type_code='gr'
left join type_mst_a f1 on EMP.department_mkey=f1.master_mkey-- and f1.type_code='d1'
left join type_mst_a g1 on EMP.designation_mkey=g1.master_mkey --and g1.type_code='dm'
join emp_mst s1 on s1.mkey=EMP.reporting_to
left join emp_mst s2 on s2.mkey=EMP.reporting_to2
left join Emp_Address_Trl addr on addr.mkey=emp.mkey
left join state_mst as s on addr.state_mkey=s.mkey
left join city_mst as c on addr.city_mkey = c.mkey
left join view_p_program pg on EMP.project_mkey=pg.mkey
left join view_p_project pr on EMP.building_mkey=pr.mkey
left join type_mst_a hub on EMP.hub_mkey=hub.master_mkey and hub.type_code='HWH'
WHERE
EMP.STATUS IN ('A','S')
所以我想要的是,我想在表单上显示已分配用户的PROJECT NAME
。
我想在页面的page_load
上显示。
<td align="right" class="Header" colspan="1">
Location : <asp:label ID="lblproject" runat="server" Visible="false" Text='<%#= %>'></asp:label>
</td>
如何绑定查询以便它可以显示相关的project name
答案 0 :(得分:1)
背后的代码
var dtAsEnum= ds.Tables[0].AsEnumerable();
string ProjectName= (from r in dtAsEnum
where r.Field<string>("Employee") == 'LoggedInUser'
select r.Field<string>("Project")).First<string>();
Label.Text = ProjectName;
可能会有所帮助或给你一个想法!
参考。链接:Select Value