Home > DeveloperSection > Forums > The type of one of the expressions in the join clause is incorrect. Type inference failed
Ashish Pandey

Total Post:128

Points:898
Posted on    September-20-2014 2:39 AM

 C# .NET  C#  LINQ 
Ratings:


 1 Reply(s)
 832  View(s)
Rate this:

I’m trying to join two tables using linq to sql. I am getting error on join keyword that "Error 14 The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'."

var query = (from es in Company.Employee_Salary

                         join ed in Company.Employee_Details on es.Employee_ID equals es.Student_ID

                         orderby es.Employee_ID

                         select new {  es.Month }).ToList();



Anchal Kesharwani
Anchal Kesharwani

Total Post:10

Points:70
Posted on    September-20-2014 2:55 AM

hi ashish,

I hope that this code help you.

What if you cast the id that is an int to a string before comparing?

var query = (from es in Company.Employee_Salary

                         join ed in Company.Employee_Details on es.Employee_ID.ToString() equals es.Student_ID

                         orderby es.Employee_ID

                         select new {  es.Month }).ToList();


Don't want to miss updates? Please click the below button!

Follow MindStick