我有一个这样的查询:
Dim clcexists = (From p In dbContext.Signatures _
Where p.StudentID = people_id _
And p.ContractType = "clc" _
Order By p.ID Descending _
Select p)
稍后我使用 IsNothing 检查 clcexists 中是否存在任何行,如下所示:
If IsNothing(clcexists) Then ' If no CLC is on file.
clcfirst = Date.Now.Subtract(year)
clcdate = clcfirst
Else ' If CLC is on file.
clcfirst = clcexists.FirstOrDefault()
clcdate = clcfirst.SignatureDate
End If
但是 IsNothing() 并没有像我预期的那样运行。结果表中没有行,但它仍然表现得好像存在并转到 Else 子句。帮助?