LINQ加入多个smallint列

时间:2015-06-24 14:29:17

标签: c# linq linq-to-sql

我想要加入多个列。如果列类型为int或string等没有问题,但我的列类型是smallint。

查询:

    var getworks = (from loc in db.T_location
                            join wl in db.T_vehicle_work_list 
                            on new {x=loc.Route_id, y=loc.Cash_center_num} 
                            equals new { x=wl.Route_id, y=wl.Cash_center_num}

                                        where wl.Route_id == getVehicleRouteId.Route_id && wl.Cash_center_num == getVehicleRouteId.Cash_center_num
                                        && wl.Status_code != "C"
                                        && wl.Instance_id > bfd
                                        && wl.Instance_id < afd
                             select new { loc, wl }).ToList();

错误:“join子句中某个表达式的类型不正确。在调用'Join'时类型推断失败。”

thanx求助......

1 个答案:

答案 0 :(得分:0)

如果有人也遇到这个问题。检查model.edmx列&#34; nullable&#34;属性相同