A
Andy B
I am trying to use an ObjectDataSource with a GridView. I have created a
class called NewsManager that the ObjectDataSource will use for its data. I
am kind of confused on what the return type of the methods should be. This
is what I have so far:
Imports System.Data.Objects
Imports System.Data.Objects.DataClasses
Public Class NewsManager
Private DBContext As New eternityrecordsonlineEntities()
'*** Return the entire list of news articles.
Public Function GetAllNews() As News
Dim NewsQuery As ObjectQuery(Of News) = _
DBContext.News
Return NewsQuery
End Function
End Class
I get this error:
Error 1 Value of type 'System.Data.Objects.ObjectQuery(Of
WebApplication1.News)' cannot be converted to 'WebApplication1.News'.
C:\Documents and Settings\Andy\My Documents\Visual Studio
2008\Projects\WebApplication1\WebApplication1\NewsManager.vb 10 10
WebApplication1
How should I fix this?
class called NewsManager that the ObjectDataSource will use for its data. I
am kind of confused on what the return type of the methods should be. This
is what I have so far:
Imports System.Data.Objects
Imports System.Data.Objects.DataClasses
Public Class NewsManager
Private DBContext As New eternityrecordsonlineEntities()
'*** Return the entire list of news articles.
Public Function GetAllNews() As News
Dim NewsQuery As ObjectQuery(Of News) = _
DBContext.News
Return NewsQuery
End Function
End Class
I get this error:
Error 1 Value of type 'System.Data.Objects.ObjectQuery(Of
WebApplication1.News)' cannot be converted to 'WebApplication1.News'.
C:\Documents and Settings\Andy\My Documents\Visual Studio
2008\Projects\WebApplication1\WebApplication1\NewsManager.vb 10 10
WebApplication1
How should I fix this?