Solved

classic Asp : Or statement syntax?

Posted on 2010-11-12
8
1,231 Views
Last Modified: 2012-05-10
Using classic asp, what is the syntax for If and or? For example what would be the correct way to do this:

if((Recordset1.Fields.Item("STATE").Value)=="NY" OR (Recordset1.Fields.Item("STATE").Value)=="IL") {
0
Comment
Question by:machine_run
  • 4
  • 2
  • 2
8 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
the == is .net, you you only need to change those into =


if((Recordset1.Fields.Item("STATE").Value)="NY" OR (Recordset1.Fields.Item("STATE").Value)="IL") {

Open in new window

0
 
LVL 1

Author Comment

by:machine_run
Comment Utility
500 INTERNAL SERVER ERROR
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
also, the { is from asp.net ....

in asp:

if (condition) then
  ...
else
  ..

end if
0
 
LVL 22

Expert Comment

by:Om Prakash
Comment Utility
Try
if Recordset1.Fields.Item("STATE").Value ="NY" OR Recordset1.Fields.Item("STATE").Value ="IL" then 

	'Other statements

end if

Open in new window

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Author Comment

by:machine_run
Comment Utility
There is some old code on the site that is not causing an error:
What is the "&&" statment?

if((Recordset1.Fields.Item("STATE").Value)=="NY" && (Recordset1.Fields.Item("STATE").Value)=="IL") {
else
{
0
 
LVL 1

Author Comment

by:machine_run
Comment Utility
if((Recordset1.Fields.Item("STATE").Value)=="NY" | (Recordset1.Fields.Item("STATE").Value)=="IL") {


Appears to be working.
0
 
LVL 22

Accepted Solution

by:
Om Prakash earned 500 total points
Comment Utility
&& is and operator

If you are using javascript then and want to convert above statement as "or" then  

if((Recordset1.Fields.Item("STATE").Value)=="NY" || (Recordset1.Fields.Item("STATE").Value)=="IL") {
}
else
{

}

0
 
LVL 1

Author Comment

by:machine_run
Comment Utility
angellll and om_prakash_p, Sorry about the asp / javascript confusion.
THANKS!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now