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

  • SEARCH
  • Home
  • 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 7701189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:55:31+00:00 2026-05-31T22:55:31+00:00

While running the code I’ve included below I receive the error EntityCommandExecutionException was unhandled

  • 0

While running the code I’ve included below I receive the error

“EntityCommandExecutionException was unhandled by user code.

I’m then told to look at the inner exception for details…and there I see under Data:

“In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.”

And under Inner Exception –> Message:

“A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 – The handle is invalid.)”

The code Visual Studio thinks is at fault is:

Dim qpeople = (From p In dbContext2.PEOPLE _
                                    Where p.PEOPLE_ID = ID _
                                    Order By p.CREATE_DATE Descending _
                                    Select p).FirstOrDefault

The larger code context is:

 Protected Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
    Dim semester As String = ddlwhSemester.SelectedValue
    Dim year As String = txtwhYear.Text
    Dim exists As String = "N"
    Dim pcsemester As String = ddlSemester.SelectedItem.Text
    Dim pcyear As String = ddlYear.SelectedItem.Text
    Using dbContext As pbu_housingEntities = New pbu_housingEntities
        ' Get the list of residents in webHousing.
        Dim qresidents = (From p In dbContext.Residents _
                          Where p.semester = semester _
                          Where p.year = year _
                         Select p.people_code_id)
        Using dbContext2 As Campus6Entities = New Campus6Entities
            ' Get the list of students in PowerCampus.
            Dim qstudents = (From p In dbContext2.RESIDENCies _
                             Join a In dbContext2.ACADEMICs _
                             On a.PEOPLE_CODE_ID Equals p.PEOPLE_CODE_ID _
                             Where p.ACADEMIC_TERM = pcsemester _
                             Where p.ACADEMIC_YEAR = pcyear _
                             Where a.ACADEMIC_TERM = pcsemester _
                             Where a.ACADEMIC_YEAR = pcyear _
                             Where a.PROGRAM = "UND" _
                             Where (a.CLASS_LEVEL = "FR" _
                             Or a.CLASS_LEVEL = "FRNR" _
                             Or a.CLASS_LEVEL = "FRST" _
                             Or a.CLASS_LEVEL = "SO" _
                             Or a.CLASS_LEVEL = "JR" _
                             Or a.CLASS_LEVEL = "SR" _
                             Or a.CLASS_LEVEL = "SR5" _
                             Or a.CLASS_LEVEL = "Tran") _
                             Select p.PEOPLE_ID).Distinct
            For Each row In qstudents
                exists = "N"
                For Each res In qresidents
                    If row.ToString = res.ToString Then
                        exists = "Y"
                    End If
                Next
                If exists = "Y" Then
                    ' Skip adding.
                Else
                    ' Add a row.
                    ' Get the ID
                    Dim ID As String = row
                    ' Get info from PowerCampus
                    Dim qpeople = (From p In dbContext2.PEOPLE _
                                    Where p.PEOPLE_ID = ID _
                                    Order By p.CREATE_DATE Descending _
                                    Select p).FirstOrDefault
                    Dim people_code_id As String = qpeople.PEOPLE_CODE_ID
                    Dim qacademic = (From p In dbContext2.ACADEMICs _
                                     Where p.PEOPLE_CODE_ID = people_code_id _
                                     Where p.ACADEMIC_TERM = pcsemester _
                                     Where p.ACADEMIC_YEAR = pcyear _
                                     Order By p.CREATE_DATE Descending _
                                     Select p.CLASS_LEVEL).FirstOrDefault
                    Dim qaddress = (From p In dbContext2.ADDRESSes _
                                    Where p.PEOPLE_ORG_CODE_ID = people_code_id _
                                    Where p.ADDRESS_TYPE = "Perm" _
                                    Order By p.CREATE_DATE Descending _
                                    Select p).FirstOrDefault
                    Dim qdemographics = (From p In dbContext2.DEMOGRAPHICS _
                                         Where p.PEOPLE_CODE_ID = people_code_id _
                                         Order By p.CREATE_DATE Descending _
                                         Select p.GENDER).FirstOrDefault

                    ' Create the new occupant.
                    Dim newres As New Resident
                    newres.people_code_id = ID
                    newres.person_name = qpeople.FIRST_NAME + " " + qpeople.MIDDLE_NAME + " " + qpeople.LAST_NAME
                    newres.first_name = qpeople.FIRST_NAME
                    newres.last_name = qpeople.LAST_NAME
                    newres.class_level = qacademic
                    newres.gender = qdemographics
                    newres.semester = semester
                    newres.year = year
                    newres.email = qaddress.EMAIL_ADDRESS
                    newres.create_date = Date.Now
                    dbContext.Residents.AddObject(newres)
                    dbContext.SaveChanges()
                End If
            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-31T22:55:32+00:00Added an answer on May 31, 2026 at 10:55 pm

    I didn’t notice this before but you are setting your ID like this:

    Dim ID As String = row 
    

    Try converting the ID to a Int before the linq query.

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

Sidebar

Related Questions

The code below while running on iphone 3g ios 4.2.1 causes an error shown
While I am running this code it showing me a following error:- Column 'virtuemart_product_id'
While running this code it shows Stackoverflow error. What is it I am doing
I am getting this error while running my code: Error using ==> mldivide Matrix
While running code in production, I don't have to interact with the Ember.js runloop
I have some debugging code that if executed while running with GBD attached should
While running a batch file in Windows XP I have found randomly occurring error
I have a Linear layout initialized. While running program, i am using following code
While running this code: NSData *archivedSavedData = [[NSData alloc] init]; archivedSavedData = [defaults objectForKey:@listOfAccessNumbers];
While running this code it shows alert. filtereditem is DevExpress listboxcontrol. existingItems is an

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.