Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
var query2 = (from pd in db.Student1s join od in db.Test_1s on pd.id equals od.No select new { od.Name, pd.name }).ToList();


Error :
VB
The type of one of the expressions in the join clause is incorrect.  Type inference failed in the call to
Posted
Updated 16-Sep-13 23:24pm
v2

Have a look at this page, there are several examples of how to use LINQ:

http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b[^]

Hope it helps you.
 
Share this answer
 
Here you can find examples for join in LinQ.

C# Join[^]

I think in your linq query the problem was caused by the difference of the type between the pd.id and od.No. The type of the two columns must be the same!

C#
var query2 = (from pd in db.Student1s
              join od in db.Test_1s on pd.id equals od.No
              select new 
                {
                    od.Name,
                    pd.name
                }).ToList();
 
Share this answer
 
v3
You need to check the following

1. that pd.id and od.No are the same type.
2. if either variable is nullable that you change the query to read from the Value property of the variables

for an example look here

The type of one of the expressions int he join clause is incorrect. Type inference failed in the call to 'join'[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900