Hi,
I've been playing with Report Viewer in VS 2008 SP1 and noticed that the Website Data Sources will not detect any business object except sth with IQueryable
Public Class DemoReport
Public Shared Function ListStudent() As IQueryable(Of Student)
Dim db As New DemoDataContext()
Dim query = From q In db.Students Select q.LastName, q.FirstName
Return query
End Function
End Class
If I have a function with return of DataTable like the following, Web Site Data Sources will not detect it, then I can't use it in the .rdlc file.
Public Shared Function ListStudent() As DataTable
Dim db As New DemoDataContext()
Dim q = From s In db.Students Select s.FirstName, s.LastName
Dim dtDataTable = New DataTable("dt")
dtDataTable.Columns.Add("First Name", GetType(String))
dtDataTable.Columns.Add("Last Name", GetType(String))
For Each a In q
dtDataTable.Rows.Add(New Object() {a.FirstName, a.LastName})
Next
Return dtDataTable
End Function
I'm not sure why it detects only IQueryable not DataTable, even though I put these two with same or separate class.. Anyone has any suggestion? Thank you.