Link to home
Create AccountLog in
Avatar of machine_run
machine_runFlag for United States of America

asked on

classic Asp : Or statement syntax?

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") {
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

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

Avatar of machine_run

ASKER

500 INTERNAL SERVER ERROR
also, the { is from asp.net ....

in asp:

if (condition) then
  ...
else
  ..

end if
Try
if Recordset1.Fields.Item("STATE").Value ="NY" OR Recordset1.Fields.Item("STATE").Value ="IL" then 
	'Other statements
end if

Open in new window

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
{
if((Recordset1.Fields.Item("STATE").Value)=="NY" | (Recordset1.Fields.Item("STATE").Value)=="IL") {


Appears to be working.
ASKER CERTIFIED SOLUTION
Avatar of Om Prakash
Om Prakash
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
angellll and om_prakash_p, Sorry about the asp / javascript confusion.
THANKS!