Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5963379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:14:36+00:00 2026-05-22T19:14:36+00:00

When I execute the code below I receive the error message: LINQ to Entities

  • 0

When I execute the code below I receive the error message:

LINQ to Entities does not recognize the method ‘System.Object CompareObjectEqual(System.Object, System.Object, Boolean)’ method, and this method cannot be translated into a store expression.

It seems to be occurring on the line For Each row2 in 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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:14:37+00:00Added an answer on May 22, 2026 at 7:14 pm

    First of all you’re doing things the most difficult way possible (row by row update in code) instead of single update to the database; that said, nothing looks incorrect on the surface of things. You might check the definition of ‘dbPC.Residencies’ to make sure it’s defined correctly, and you may need to put an “if (PCStudent.Any())” check before your “For Each”, though it ought to work as written.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How does one execute some VBA code periodically, completely automated?
How does a virtual machine generate native machine code on the fly and execute
Is there a way to execute code after each Terminal? So that something like
I have a form with a few buttons which execute code when pressed like
I'd like to execute JavaScript code from within a C# assembly and have the
In an impersonation scenario related to Sharepoint I need to execute some code in
So far I've been using public void run() {} methods to execute my code
I can do an eval(something()); to execute the code dynamically in JavaScript. Is there
I'm using the following code to execute a query in Lucene.Net var collector =
using register_shutdown_function I can register code to execute at the end of a PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.