我有一个需要从表中获取字符串值列表的场景。
我需要查询Subject
表并获取主题列表:
EmployeeDetails emp = new EmployeeDetails();
emp.subjects = from x in EmpDB.subjects
join y in EmpDB.employeeInfo
on x.subjectCode equals y.subjectCode select new
{
x.subjectTitle,
}.toList();
我有一个员工ID,我需要查询EmployeeDetails
表并获取特定SubjectCodes
的{{1}},并且使用这些主题代码,我需要查询{{1 }}表并获取主题值。
答案 0 :(得分:0)
我假定在EmployeeDetails类中,您具有带有“列表”的“主题”。
EmployeeDetails emp = new EmployeeDetails();
emp.subjects = (from x in EmpDB.subjects
join y in EmpDB.employeeInfo on x.subjectCode equals y.subjectCode
where y.EmployeeId = <<your ID>> // Employee ID you searching
select x.subjectTitle).ToList();