Solved

classic Asp : Or statement syntax?

Posted on 2010-11-12
8
1,236 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP Classic - JavaScript - Get value from form in iFrame and pass to main page. 2 40
Reg Exp to extract Url from string asp 12 57
SQL to JSON 14 65
Getting robots.txt Error 9 56
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 was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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