可能重複:
LINQ2SQL: Cannot convert IQueryable<> to IOrderedQueryable error無法隱式轉換類型 'System.Linq.IQueryable <>' 到 'System.Linq.IOrderedQueryable <>'
我具有在該錯誤我的控制器的搜索字符串..
這裏是我的代碼:
if (!String.IsNullOrEmpty(searchString))
{
posts = posts.Where(post => post.Body == searchString);
}
我在我的索引中使用此代碼進行搜索。 我在這裏或某處宣佈了什麼錯嗎?我已經嘗試了谷歌搜索,但沒有找到明確的答案。預先感謝任何可以幫助我的人..
什麼是職位和你是怎麼聲明/使用它呢? – V4Vendetta
此主題看起來類似:http://stackoverflow.com/questions/1732236/linq2sql-cannot-convert-iqueryable-to-iorderedqueryable-error什麼數據類型是帖子?它從哪裏來的?你在任何地方做任何排序(orderby)嗎? – JLRishe