0
var quotes = (from q in db.Intrebaris 
    where q.id_materie == id_mat & q.id_tip_intrebare == tip_intr
    select q)
    .OrderBy(x =>SqlFunctions.Rand())
    .Take(10);

return quotes.ToList();

你知道为什么会这样吗?非常感谢!

4

1 回答 1

2

这是因为SqlFunctions.Rand(). MSDN说:

您不能直接调用此函数。此函数只能出现在 LINQ to Entities 查询中。该函数被翻译成数据库中的相应函数。

于 2017-01-10T09:23:47.603 回答