I would like to fetch datas with checking id with some numbers.
我想通过检查带有一些数字的id来获取数据。
int r = 0;
var ask = from y in entity.sorulars
where y.soru_id == questionID[r]
select new { y.sorutipi_id };
foreach (var hold2 in ask)
{
questionTypeID[r] = hold2.sorutipi_id;
r++;
}
I use these codes but
我使用这些代码但是
"The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities."
“LINQ to Entities不支持LINQ表达式节点类型'ArrayIndex'。”
error appears. I guess questionID[r]
is not supported in LINQ
so what should I type instead of it. Thank you
出现错误。我猜LINQ不支持questionID [r],所以应该输入什么而不是它。谢谢
1 个解决方案
#1
3
Try this way, declare var Id=questionID[r];
variable globally and pass the id
to your query
试试这种方式,声明var Id = questionID [r];全局变量并将id传递给您的查询
int r = 0;
var Id= questionID[r];
var ask = from y in entity.sorulars
where y.soru_id == Id
select new { y.sorutipi_id };
foreach (var hold2 in ask)
{
questionTypeID[r] = hold2.sorutipi_id;
r++;
}
#1
3
Try this way, declare var Id=questionID[r];
variable globally and pass the id
to your query
试试这种方式,声明var Id = questionID [r];全局变量并将id传递给您的查询
int r = 0;
var Id= questionID[r];
var ask = from y in entity.sorulars
where y.soru_id == Id
select new { y.sorutipi_id };
foreach (var hold2 in ask)
{
questionTypeID[r] = hold2.sorutipi_id;
r++;
}