Link to home
Start Free TrialLog in
Avatar of Gemini532
Gemini532Flag for United States of America

asked on

How do I make something not equal to NULL in ASP

Hello Everyone, I really need code that makes a variables
dim onj
onj <> Null
in ASP(VBScript)

Can you help ?!?!
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gemini532

ASKER

I tried this if statment, and it's nto working:

If IsEmpty(contactEmail) or (contactEmail = "") or (not isnull(contactEmail)) then
<%set rsContact = Server.CreateObject("ADODB.Recordset")
with rsContact
	.open contactValues, objConn,3,3
	if .Recordcount=1 then
		contactEmail				= .Fields("PointOfContact")
	end if
	.close
end with
 
 
If IsEmpty(contactEmail) or (contactEmail = "") or (not isnull(contactEmail)) then 
      contactEmail ="fake@fake.com"
	   
End If
 
response.write "The email is [" & contactEmail &"] and it works YEY"
response.End()
 
%>

Open in new window

I keep getting this:
The email is [] and it works YEY
I thought it would work, so I added the YEY, but it doesn't OH WY NOT?
I tried this:

if isnull(recordset.fields("PointOfContact").value) then

And I got this error:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/OPICForms/115/115-confirm_submit.asp, line 53


What coudl it be?

I figure I took the not
if NULL then the email is replaced by fake@fake.com

If not null then it's OK
so that's why altered the if statment from

if not isnull(recordset.fields("yourfield").value) then

to

if isnull(recordset.fields("yourfield").value) then

Is this correct?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I got it!  Thank you all for helping