【发布时间】:2013-03-21 18:11:49
【问题描述】:
我正在尝试从 Fderive 中获取所有数据,但是我正在尝试使用 where 子句设置过滤器。不幸的是,当我在 spd 中的一行为空时触摸 spd 时,我得到一个 nullreferencexpection。
var Result = from fpd in FDerive
join spd in SDerive
on new { fpd.PId, fpd.SId }
equals new { spd.PId, spd.SId } into allRows
from spd in allRows.DefaultIfEmpty()
where spd.SId == ""
|| spd.PId == ""
select new { fpd, spd };
如何解决 null 错误?
【问题讨论】:
-
这里需要右连接还是内连接?
-
还有。您正在检查它们是否为空,您不应该检查它们是否为空吗?
-
我想这是我的问题,我试图检查空行程的一切都是空错误。仍在寻找正确的组合来检查 null
标签: c# linq nullreferenceexception