?
Solved

classic Asp : Or statement syntax?

Posted on 2010-11-12
8
Medium Priority
?
1,244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 34122258
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
ID: 34122296
500 INTERNAL SERVER ERROR
0
 
LVL 143

Expert Comment

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

in asp:

if (condition) then
  ...
else
  ..

end if
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 22

Expert Comment

by:Om Prakash
ID: 34122335
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
 
LVL 1

Author Comment

by:machine_run
ID: 34122415
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
ID: 34122512
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 2000 total points
ID: 34122644
&& 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
ID: 34122816
angellll and om_prakash_p, Sorry about the asp / javascript confusion.
THANKS!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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