在 C# 2008 windows 应用程序中,我有以下指向 sql server 2008 r2 数据库的 linq to sql 语句。以下查询返回 null。但是有记录要取。
//代码
string SubmissionPkgID = "valid string value";
var varGoodTransCount = (from t in rData.Transactions
join iw in rData.Ibooks on t.ImportID equals iw.ImportID
join ip in rData.IPackages on iw.PID equals ip.PID
where (ip.trc_num != null) && ip.trc_num == SubmissionPkgID
group ip by ip.trc_num into g
select new { trc_num = g.Key, Frequency = g.Count() }).FirstOrDefault();
注意:SubmissionPkgID 确实包含有效值。我穿在哪里?