Reputation: 117
I want to convert the below string into classic asp code can any one help email has some value but it is not going inside the Loop Can any one help me.
If (IsEmpty(email) And IsNull(email)) Then
EndIf
Upvotes: 1
Views: 1180
Reputation: 13213
Why don't you just check the length of the email variable:
If Len(Trim(email)) > 0 Then
Else
YOUR CODE HERE
End If
Upvotes: 0
Reputation: 12210
You could always try:
If IsEmpty(email) = True Then
'uninitialized
ElseIf IsNull(email) = True Then
'contains null value
ElseIf email = ""
'contains zero length string
Else
'Response.Write email
'MsgBox email
End If
In most cases I try to code so that the variable is guaranteed to be initialized so you don't need to run the IsEmpty check.
Option Explicit
Dim email
email = ""
Upvotes: 2
Reputation: 189457
The code looks like its VBScript already so there is no "conversion" needed, however the code is faulty. Should be:
If IsEmpty(email) Or IsNull(email) Then
End If
a variable cannot both be empty and contain a Null at the same time hence the orginal conditional expression was always false.
Upvotes: 4