简体   繁体   English

LINQ在多个smallint列上联接

[英]LINQ Join on Multiple smallint Columns

i am tying to join multiple columns. 我想加入多个专栏。 There is no problem if column type int or string etc.. but my columns types are smallint. 如果列类型为int或字符串等,则没有问题。但是我的列类型为smallint。

query: 查询:

    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();

error : "The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'." 错误:“ join子句中的表达式之一的类型不正确。对'Join'的调用中类型推断失败。

thanx for help... 感谢帮助...

If anybody have this problem too. 如果有人也有这个问题。 Check the model.edmx column "nullable" properties are same 检查model.edmx列的“ nullable”属性是否相同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM