不能将 Null 值赋给类型为 System.Int32 (不可为 null 的值类型)的成员。

romanchaos romanchaos 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

from p in Sys_operators
where p.Id == 5
select new
{
Region = new { Id = p.Regions.Id, Label = p.Regions.Rname },
Wid = p.Warehouse.Id,
Curr = new { Id = p.Curr.Id, Ccode = p.Curr.Ccode }
}

以上linq会报标题所示的异常,表Sys_operators和其他三张表(Regions,Warehouse,Curr)建立了主外键关系,是不是有可能外表为null所以不能这样select出其中的属性?
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
romanchaos
LINQ 8,492 成员 4,736 内容