Sandeep Kushwah
Sandeep Kushwah

Reputation: 592

C# Linq to SQL: The type of one of the expressions in the join clause is incorrect. Type inference failed

I am writing a join query on 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'." Could you please help me? Let me know if anything else needed.

var query = (from fd in dbcDefaulter.Fees_Dues
                         join sd in dbcDefaulter.Student_Details on fd.Student_ID equals sd.Student_ID
                         orderby fd.Student_ID
                         select new {  fd.Month }).ToList();

Upvotes: 0

Views: 136

Answers (1)

Rufus L
Rufus L

Reputation: 37020

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

var query = (from  fd in dbcDefaulter.Fees_Dues
                 join sd in dbcDefaulter.Student_Details 
                 on fd.Student_ID.ToString() equals sd.Student_ID
                 orderby fd.Student_ID
                 select new {  fd.Month }).ToList();

Upvotes: 2

Related Questions