Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Wpf and backend coding is linq to sql.
I am try to join two query but an exception occur that is "the type of one of the expressions in the join clause is incorrect. type inference failed in the call to join "
my code id:-
var accountDetail = from account in accountSD.Accounts
                                         join
                                         studentMaster in accountSD.StudenMasterTables on account.Alias equals studentMaster.stdACID 
                                         select new
                                            {
                                                account.Aid,
                                                account.Alias,
                                                account.AccountId,studentMaster.stdCARDID,
                                                studentMaster.stdName,
                                                studentMaster.stdFather
                                            } ;

how to solve this problem ??
Posted
Updated 26-Feb-15 1:04am
v2
Comments
George Swan 26-Feb-15 13:02pm    
Is the Type of account.Alias exactly the same as that of studentMaster.stdACID?
J{0}Y 27-Feb-15 4:30am    
no so i correct it and it is work well

1 solution

C#
//The  Type name on each side of the equals operator has to be the same
//So try doing this 
var accountDetail = from account in accountSD.Accounts
                    join
                    studentMaster in accountSD.StudenMasterTables  
                    on 
                    new {account.Alias} equals new{Alias=studentMaster.stdACID}
 
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