943,545 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 17246
  • ASP RSS
Jan 20th, 2006
0

Boolean variable True/false

Expand Post »
Hi there,
Using DMX4 & MsAccess (ASP VBScript)

i'm trying to show my True/false results as Yes/No. I am trying this at the mo:
<%If(RsNewProds.Fields.Item("Org").Value)=1 Then
Response.Write("Yes") else Response.Write("No")end if%>

but it comes up with error 0x800A0412 at the 'else' bit of the script

Any thoughts??
Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Georgina is offline Offline
2 posts
since Jan 2006
Jan 23rd, 2006
0

Re: Boolean variable True/false

asp can appear tempermental with if statements. Try this.
<%
If(RsNewProds.Fields.Item("Org").Value)=1 Then
Response.Write("Yes")
else
Response.Write("No")
end if
%>
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005
Jan 23rd, 2006
0

Re: Boolean variable True/false

Thanks it worked!!!
Georgina
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Georgina is offline Offline
2 posts
since Jan 2006
Jan 25th, 2006
0

Re: Boolean variable True/false

Clean it up and do it the right way

ASP Syntax (Toggle Plain Text)
  1. <%
  2. If CBool(RsNewProd("Org")) Then
  3. Response.Write("Yes")
  4. Else
  5. Response.Write("No")
  6. End If
  7. %>

The cleaner you code the easier it is to go back and edit things.
Reputation Points: 25
Solved Threads: 7
Junior Poster
Drew is offline Offline
166 posts
since Apr 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Designing an Intranet using ASP
Next Thread in ASP Forum Timeline: shopping cart





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC