Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while joining three tables i am getting error. please solve this error anybody. how to get data from 3 tables.getting error in second join condition says that "the type of one of the join condition is incorrect".

What I have tried:

var query = from s in dbContext.SapDumpFebs
                       join u in dbContext.UserDetails on s.USER_ID equals u.USER_ID
                       join g in dbContext.GlTexts on s.GL_AC_NO equals g.GL_AC_NO
                       select new
                       {
                           /// columns to retrieve
                       };
Posted
Updated 6-Apr-17 22:33pm
Comments
Suvabrata Roy 7-Apr-17 3:17am    
The types and the names of the properties in the anonymous types must match...

1 solution

The error means that the columns you are trying to join on are not the same data type. You must ensure they are the same type.

So as you have said it is the second join causing the problem, then that means that the following columns are different data types.

SapDumpFeb.GL_AC_NO
GlText.GL_AC_NO

Check these and make sure they match.

Alternatively, if you can't change the type you may be able to convert one of them in the join. For example, if one is a string you can convert the other to string in the join:

C#
join g in dbContext.GlTexts on Convert.ToString(s.GL_AC_NO) equals g.GL_AC_NO
 
Share this answer
 
v3

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