0

我试图将 sql 查询写入 linq:

询问:

select s.s_name, sub.state, sub.to, sub.evaluation, sub.task_id
from submit_task sub
join student s on s.id=sub.student_id
join task t on t.id=sub.task_id
where t.t_name = "bbbb";

林克:

var subTask = (from sub in ado.submit_task
               join s in ado.student on sub.student_id equals s.id
               join t in ado.task on sub.task_id equals t.id
               where t.t_name == listView3.SelectedItems[0].Text
               select new { s.s_name, sub.state, sub.to, 
                            sub.evaluation, sub.task_id });

但这不起作用。当我尝试 dubugg 时,什么都没有发生,没有错误或结果。你看出什么错误了吗??

谢谢你

4

1 回答 1

1
var text = listView3.SelectedItems[0].Text;

var subTask = (from sub in ado.submit_task
  join s in ado.student on sub.student_id equals s.id
  join t in ado.task on sub.task_id equals t.id
  where t.t_name == text
  select new { s.s_name, sub.state, sub.to, sub.evaluation, sub.task_id });
于 2013-05-04T12:31:34.223 回答