已经是一个开放的数据阅读器

时间:2016-01-12 06:42:17

标签: c# linq

using (var context = new PostBoard()) {

                var projectresult = context.projects.Select(pro => new  {
                    pro.id,
                    pro.participant_name,
                    pro.moderator_name,
                    pro.start_date,
                    pro.end_date,
                    pro.account_id,
                    discussion_sections = pro.discussion_sections.Select(ds => new {
                        ds.id,
                        ds.title,
                        ds.project_id
                    }).Where(ds => ds.project_id == pro.id)
                }).Where(pro => pro.id == id);

                var test = projectresult;
}

当我尝试调试并查看projectresult结果时,它被分配给测试我收到一个错误,指出已经有一个开放的数据读取器。

0 个答案:

没有答案