devxlogo

Prevent Confusion Between IsNULL and IsEmpty in VBScript

Prevent Confusion Between IsNULL and IsEmpty in VBScript

When you deal with unknown return values or variant variables whose types might be unknown, you may not know whether the value of the variable is an EMPTY string or a NULL value. In VBScript—where all variables are variants—variables can be one of two special values: EMPTY or NULL. EMPTY is defined as a variable with an un-initialized value, whereas NULL is a variable that contains no valid data.

NULL and EMPTY must be tested for in different manners. For example, with the following syntax, both must be tested before using the variable in question:

 If IsNull(variable)  Or  IsEmpty(variable) Then

devx-admin

Share the Post: