We help IT Professionals succeed at work.

How do I make something not equal to NULL in ASP

Gemini532
Gemini532 asked
on
2,739 Views
Last Modified: 2012-06-21
Hello Everyone, I really need code that makes a variables
dim onj
onj <> Null
in ASP(VBScript)

Can you help ?!?!
Comment
Watch Question

Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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

Author

Commented:
I keep getting this:
The email is [] and it works YEY

Author

Commented:
I thought it would work, so I added the YEY, but it doesn't OH WY NOT?

Author

Commented:
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?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I got it!  Thank you all for helping
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.