我正在尝试使用 VB.NET 加载 Gridview,但是当我执行 Linq 查询时收到以下消息。我正在执行一个存储过程。我检查了 SQL Server 上的 SP,它正在返回结果,但我无法让 VB.Net 接受结果。我对 Linq 和实体框架非常陌生。任何帮助,将不胜感激。
消息=无法将类型“
WhereSelectEnumerableIterator2[
WindowsApplication1.uspGetAll_Result,WindowsApplication1.uspGetAll_Result
]”的对象转换为类型“System.Linq.IQueryable
1[WindowsApplication1.uspGetAll_Result`]”。
这是代码。
'Using Linq to Entities
Dim CatFNQuery As IQueryable(Of uspGetAll_Result)
CatFNQuery = From x In fanDbContext.uspGetAll(Nothing, Nothing, Nothing) _
Select x
'MsgBox(CatFNQuery.Count)
If CatFNQuery Is Nothing Then
'
Else
gvResults.DataSource = CatFNQuery
End If
它在 CATFNQUERY = ... 行上失败。