VBS tutorial: Functions – isnull functions

Time:2021-10-15

Isnull function

Returns a Boolean value indicating whether the expression does not contain any valid data (null).

IsNull(expression)

expressionParameters can be any expression.

explain

IfexpressionbyNull, thenIsNullreturnTrue, that is, the expression does not contain valid data, otherwiseIsNullreturnFalse。 IfexpressionIf it consists of multiple variables, theNullWill cause the entire expression to returnTrue

NullValue indicates that the variable does not contain valid data.NullUnlike empty, the latter indicates that the variable is uninitialized. Null is also different from zero length string (“”), which often refers to an empty string.

a keyuseIsNullFunction to determine whether an expression containsNullValue. In some cases, you want the expression to take a value ofTrueFor example, ifvar = null and ifvar < > null, but they are usually always nullFalse。 This is because anyNullThe expression itself isNullSo the result of the expression isFalse

The following example usesIsNullFunction to determine whether a variable containsNull

Dim myvar, mycheckmycheck = isnull (myvar) 'returns false. Myvar = null 'is assigned null. Mycheck = isnull (myvar) 'returns true. Myvar = empty 'is assigned empty. Mycheck = isnull (myvar) 'returns false.

Recommended Today

SQL statement of three-level linkage of provinces, cities and counties

The first is the table creation statement Copy codeThe code is as follows: CREATE TABLE `t_address_province` ( `id` INT AUTO_ Increment primary key comment ‘primary key’,`Code ` char (6) not null comment ‘province code’,`Name ` varchar (40) not null comment ‘province name’)Engine = InnoDB default charset = utf8 comment = ‘province information table’; CREATE TABLE […]