Expressions in VBScript/ASP with "null" in it, will always return FALSE. See the examples below:
Dim test
If (test=null) Then Response.Write "True" Else Response.Write "False" End If
If Not(test=null) Then Response.Write "True" Else Response.Write "False" End If
Both will show "False". Because "null" is in the expression, none of them will ever return True.
This is because any expression containing a Null is itself Null and therefore False.
Too make it more confusing, look at this example:
test_avc = null
Response.Write IsNull(test_avc)
If (test_avc=null) Then response.write "True" Else Response.Write "False" End If
This will return "True … False".
See the VBScript IsNull Reference:
"Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null, and therefore, False."
Leave A Comment