我遇到以下LINQ查询的问题,该问题在帖子标题中引发了异常:
Dim test = From Match In _
(From Load In dtContacts _
Group Join Siebel In dtSiebel _
On Load("Email") Equals Siebel("EMAIL_ADDRESS") _
Into g = Group _
From LoadResults In g.DefaultIfEmpty _
Where Not LoadResults Is Nothing _
Select Email_Address = Load.Field(Of String)("Email"), _
Load_Account_Number = Load.Field(Of String)("AccountNum")) _
Group Join Acct In dtSiebel _
On Match.Email_Address Equals Acct("EMAIL_ADDRESS") _
And Not Match.Load_Account_Number Equals Acct("ACCOUNT_NUMBER") _
Into h = Group _
From MatchResults In h.DefaultIfEmpty _
Where Not MatchResults Is Nothing _
Select Contact_Row_ID = MatchResults.Field(Of String)("CONTACT_ROW_ID"), _
Match.Email_Address, _
Match.Load_Account_Number, _
Account_Num_Chk = MatchResults.Field(Of String)("ACCOUNT_NUMBER")
罪魁祸首就是这条线:
And Not Match.Load_Account_Number Equals Acct("ACCOUNT_NUMBER")
对我来说没有意义的是,如果我删除'Not'子句(我用于另一个用例),其余的查询保持不变,我得到的预期结果没有任何异常。这有什么问题?
答案 0 :(得分:0)
你可以尝试
And Also Not Match.Load_Account_Number Equals Acct("ACCOUNT_NUMBER")