The type of one of the expressions in the join clause is incorrect. Type inference failed in the cal

Posted by Kasani007 under LINQ on 11/3/2015 | Points: 10 | Views : 3466 | Status : [Member] | Replies : 1
I Had written the LinQ query then, it is showing error at join as below:
The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.

List<AlertInfo> AlertInfos = new List<AlertMaster>();
List<DataBusiness> dataBusiness = new List<DataMessage>();

List<BusinessTableInformation> Alertlist = (from a in AlertInfos
join m in dataBusiness // Here error is showing
on a.AlertId equals m.AlertId
where a.SendEmail == true && m.Mode == true && m.MailSent == null && m.Type == 1
select new BusinessTableInformation
{
UserId = m.UserId,
AlertId = m.AlertId,
BusinessId = m.BusinessId,
EmailNote = a.EmailNote,
StatusId = a.Status.StatusId
}).ToList<BusinessTableInformation>();


please help me.....




Responses

Posted by: Sheonarayan on: 11/3/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
1
Down
This kinds of error is very misguiding. Try to use equals instead of == or == instead of equals and your program should run.

Try smaller query first. For example first just join the query and get the result, then try to add && filter one by one. This way you know where is the error.

While joining try to join with == instead of equals. Interchange them in the whole query and see if it works.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response