Когда я выполняю код ниже, я получаю сообщение об ошибке:
LINQ to Entities не распознает метод «System.Object CompareObjectEqual (System.Object, System.Object, Boolean)», и этот метод не может быть преобразован в выражение хранилища.
Кажется, что это происходит в строке For Each row2 в PCstudent.
Protected Sub btnPushSemester_Click(sender As Object, e As EventArgs) Handles btnPushSemester.Click
Dim dbPC As New Campus6Entities
Dim dbContext As New pbu_housingEntities
Dim getOccupants
Dim thisYear As String
Dim thisTerm As String
Using dbContext
Dim get_Year = From p In dbContext.Configs _
Where p.Description = "year" _
Select p
Dim get_Term = From p In dbContext.Configs _
Where p.Description = "term" _
Select p
thisYear = get_Year.First.textValue
thisTerm = get_Term.First.textValue
getOccupants = From p In dbContext.Residents _
Where p.semester = thisTerm _
Where p.year = thisYear _
Select p
Using dbPC
For Each row In getOccupants
Dim student_info = row
Dim people_id = student_info.people_code_id
Dim building_code = student_info.Building1.building_code
Dim room = student_info.Room1.room1
Dim PCstudent = From r In dbPC.RESIDENCies _
Where r.PEOPLE_ID = people_id _
Where r.ACADEMIC_YEAR = thisYear _
Where r.ACADEMIC_TERM = thisTerm _
Select r
For Each row2 In PCstudent
Dim student_info2 = row2
student_info2.DORM_BUILDING = building_code
student_info2.DORM_ROOM = room
student_info2.RESIDENT_COMMUTER = "R"
student_info2.DORM_CAMPUS = "O000000001"
dbPC.SaveChanges()
Next
Next
End Using
End Using
End Sub