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
Solved

classic Asp : Or statement syntax?

Posted on 2010-11-12
8
1,234 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 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 500 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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