I want to declare a variable to hold the query result from LINQ to SQL like to the following:
Dim query As IQueryable(Of Student)
If isNoUserName Then
query = From st In db.Students _
Order By st.AssignedId Ascending _
Where (st.studentId = studentId _
Select st
Else
'' error here
query = From st In db.Students _
Order By st.firstName Ascending _
Join user In db.MSUsers On user.UserId Equals st.UserId _
Where st.studentId = studentId _
Select st.firstName, st.lastName, user.userName
End If
Return query
Error : conversions from 'System.Linq.IQueryable(Of )' to 'System.Linq.IQueryable(Of Student)'.
How do I declare variable "query" to hold both data from "Student" and "User" tables?
Thank you.