我试图通过使用这个来获取Table1和Table2中的信息....
Public Shared Function SelectDataByDateAndLastName(ByVal Date As Date, ByVal TxtBoxLastName As String)
Dim TableItems As ObjectQuery(Of tblTable1) = From TableItem In tblTable1.Include("tblTable2")
Where TableItem.ItemDate = Date _
And tblTable2.LastName = TxtBoxLastName
Return TableItems
但是我在tblTable2.LastName
上收到错误Reference to a non-shared member requires an object reference
有关如何从Table2获取LastName
信息的任何想法?或者我甚至没有使用这个权利?谢谢!
答案 0 :(得分:1)
应该有一个导航属性 - 您可以像这样访问它:
Dim TableItems As ObjectQuery(Of tblTable1) =
From TableItem In tblTable1.Include("tblTable2")
Where TableItem.tblTable2.LastName = TxtBoxLastName