检查 NULL 或空字段 - 快捷方式

要获得 Null 或 Empty 检查的较短版本,请使用“= Nothing”比较。

Iif(Fields!UserEmail.Value = Nothing, "Null or Empty", "Not Null or Empty")

“= Nothing”将同时检查 Null 或 Empty,给出更紧凑的表达式。这适用于 String,Numeric 和 Boolean。来自 MSDN:

Nothing represents the default value of a data type. The default value depends on whether the variable is of a value type or of a reference type.
A variable of a value type directly contains its value. Value types include all numeric data types, Boolean, Char, Date, all structures, and all enumerations. A variable of a reference type stores a reference to an instance of the object in memory. Reference types include classes, arrays, delegates, and strings. For more information, see Value Types and Reference Types.
If a variable is of a value type, the behavior of Nothing depends on whether the variable is of a nullable data type. To represent a nullable value type, add a ? modifier to the type name. Assigning Nothing to a nullable variable sets the value to null.

如果它们为 null 或空字符串“”,则 String 将等于 Nothing。

如果数字为 0,数字将等同于 Nothing。

如果他们是假的,布尔人将等同于 Nothing。

有关类型和默认值的完整列表,请检查(当前)MSDN 页面是否为 Nothing