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 5980405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:47:45+00:00 2026-05-22T21:47:45+00:00

So I was trying to convert a SQL into LINQ query the logic is:

  • 0

So I was trying to convert a SQL into LINQ query

the logic is:

  JOIN SalesPeriod SP1 
  ON
     SP1.SalesPeriodId = SE1.SalesPeriodId AND SP1.SalePeriodId = .....(XML stuff)

but it keeps complaining the types on both sides of equals statement don’t match

Any ideas?

Note: I declared b and d because it doesn’t accept anonymous type members
and I tested two equal conditions separately and they both work

thanks

   join SP1 in fentities.SalesPeriods
                on new { SE1.SalesPeriodId, b = XDocument.Load(MI.Body).Element("ns:Transfer").Element("ns:ReceivedBy").Element("ns:Id").FirstNode.ToString() }
                equals new { SP1.SalesPeriodId, d = SP1.SalesPeriodId.ToString() }
  • 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-22T21:47:46+00:00Added an answer on May 22, 2026 at 9:47 pm

    Simple, they’re not the same (compatible) types. The first key has a SalesPeriodId of type whatever, and b of type string. The second key has a SalesPeriodId of type whatever (probably the same as the first’s), and d of type string. You can’t compare these to eachother. It must have the same properties of the same types declared in the same order. Just pick one of the names b or d and use that name.

    ...
    join SP1 in fentities.SalesPeriods
        on new { SE1.SalesPeriodId, b = XDocument.Load(MI.Body).Element("ns:Transfer").Element("ns:ReceivedBy").Element("ns:Id").FirstNode.ToString() }
        equals new { SP1.SalesPeriodId, b = SP1.SalesPeriodId.ToString() }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert a SQL query to LINQ. Somehow my count(distinct(x)) logic
I am trying to convert this sql into my LINQ query and am having
I am trying to convert the following SQL into a LINQ expression SELECT COUNT(ID)
I'm trying to convert this SQL query to LINQ: SELECT Items.p_Name Product, DiamondCategory.dc_Name Category,
I'm trying to convert this SQL into a Linq2SQL query, however, I'm at the
I'm trying to convert some SQL queries into Linq to avoid multiple trips to
I am trying to convert this short SQL statement into linq but I am
I'm trying to convert a PostgreSQL into SQL Server. But this query doesn't work.
I'm trying to convert a Linq query to SQL. My Linq query looks like
Here is a SQL query that I am trying to convert in to Linq.

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.