Linq To SQL。我收到错误的原因join子句中某个表达式的类型不正确。调用“加入”时类型推断失败 [英] Linq To SQL. why I am getting Error The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'

查看:551
本文介绍了Linq To SQL。我收到错误的原因join子句中某个表达式的类型不正确。调用“加入”时类型推断失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LINQ
{
    class Program
    {
        static void Main(string[] args)
        {
            NorthwindEntities linq = new NorthwindEntities();
            IEnumerable<employee> emps=    linq.Employees.Where(x => x.TitleOfCourtesy == "Ms." || x.Title == "Sales Representative");

            IEnumerable<customer> csts = linq.Customers.Where(x => x.Country == "Mexico");
            var v = from l1 in emps
                    join l2 in csts
                        on l1.EmployeeID equals l2.CustomerID
                    select l1.Title;           
        
        }
    }
}

推荐答案

您的employeeid和customerid都不是同样,两个ID的数据类型都存在问题
Either your employeeid and customerid are not same else there is problem in datatypes of both the ids


这篇关于Linq To SQL。我收到错误的原因join子句中某个表达式的类型不正确。调用“加入”时类型推断失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆