• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1250
  • Last Modified:

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") {
0
machine_run
Asked:
machine_run
  • 4
  • 2
  • 2
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
machine_runAuthor Commented:
500 INTERNAL SERVER ERROR
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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.

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


Appears to be working.
0
 
Om PrakashCommented:
&& 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
 
machine_runAuthor Commented:
angellll and om_prakash_p, Sorry about the asp / javascript confusion.
THANKS!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now