Reputation: 195
I would like to fetch datas with checking id with some numbers.
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."
error appears. I guess questionID[r]
is not supported in LINQ
so what should I type instead of it. Thank you
Upvotes: 5
Views: 81
Reputation: 38703
Try this way, declare var Id=questionID[r];
variable globally and pass the id
to your query
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++;
}
Upvotes: 3