Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 If nothing then A if not then B
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

JohnC
Junior Member

215 Posts

Posted - 21 December 2007 :  12:20:56  Show Profile
Newbie here! I'm working on a simple form in ASP. When the form field is empty, I want the results to display "None Available" and when there's something entered, I want that to be displayed. Here's the code I came up with so far:
<%
If rsVids.Fields.Item("SampleVid").Value = "" Then
      Response.Write("None Available")
   Else
     Response.Write(rsVids.Fields.Item("SampleVid").Value) 
   End If
%>
So far, when something is entered into the form it writes to the database and displays correctly on the results page. However, when there is nothing (NULL) in the form field, "None Available" does not show on the results page. What am I doing wrong?

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 December 2007 :  12:25:51  Show Profile  Send ruirib a Yahoo! Message
Try this

<%
If IsNull(rsVids.Fields.Item("SampleVid").Value) Then
      Response.Write("None Available")
   Else
     Response.Write(rsVids.Fields.Item("SampleVid").Value) 
   End If
%>


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

JohnC
Junior Member

215 Posts

Posted - 21 December 2007 :  12:44:22  Show Profile
You're a genius, Rui!

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 December 2007 :  12:45:51  Show Profile  Send ruirib a Yahoo! Message
Not quite, but thanks .


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

JohnC
Junior Member

215 Posts

Posted - 21 December 2007 :  13:39:25  Show Profile
Now I want the results to be a hyperlink. Change:

Response.Write(rsVids.Fields.Item("SampleVid").Value)
To what?

I tried this:

Response.Write(<a href="(rsVids.Fields.Item ("SampleVid").Value) "target="_blank" rel="nofollow">test</a>)
And this:
Response.Write(<a href=" & rsVids.Fields.Item ("SampleVid").Value & "target="_blank" rel="nofollow">test</a>)
and other variations but nothin.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 21 December 2007 :  13:45:03  Show Profile  Send ruirib a Yahoo! Message

Response.Write "<a href=""" & rsVids.Fields.Item ("SampleVid").Value &  """target=_blank rel=""nofollow"">test</a>"


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

JohnC
Junior Member

215 Posts

Posted - 21 December 2007 :  13:48:28  Show Profile
Oh I just knew it was those darn pesky commas!

You are a wealth of information, Rui! Thanks again!

Edited by - JohnC on 21 December 2007 13:54:49
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07