Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Conditional giving me fits!

Reply
Thread Tools

Conditional giving me fits!

 
 
Drew
Guest
Posts: n/a
 
      06-16-2005
I have the following simple conditional on my page,

If EmpIDError <> 1 Then
'Show Input items
End If

Now I need to add another conditional to this,

If PosIDError <> 1 Then
'Show input items
End If

So I made it like this,

If EmpIDError <> 1 OR PosIDError <> 1 Then

But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?

Thanks,
Drew


 
Reply With Quote
 
 
 
 
Drew
Guest
Posts: n/a
 
      06-16-2005
I never figured out how to get them both on the same line, so I just did
this,

<%If EmpIDError <> 1 Then%>
<%If PosIDError <> 1 Then%>

And then added two End Ifs after the code...

thanks,
drew


<
"Drew" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I have the following simple conditional on my page,
>
> If EmpIDError <> 1 Then
> 'Show Input items
> End If
>
> Now I need to add another conditional to this,
>
> If PosIDError <> 1 Then
> 'Show input items
> End If
>
> So I made it like this,
>
> If EmpIDError <> 1 OR PosIDError <> 1 Then
>
> But the problem is that if PosIDError = 1, then it still shows the input
> items. But if I take the EmpIDError <> 1 out then it works with no
> problems. Why would this be like this?
>
> Thanks,
> Drew
>



 
Reply With Quote
 
 
 
 
Mark Schupp
Guest
Posts: n/a
 
      06-16-2005
OR means that the if block should be executed if either condition is true so
the only way that the code will not execute will be if both variables = 1.
If you do not want the code to execute when any one of the variables = 1 you
need to use AND.

Also, make sure that the variables contain a numeric value (not a string
containing a numeric). If you are not sure then include a conversion in the
if statement.

If CLng(EmpIDError) <> 1 OR CLng(PosIDError) <> 1 Then

--
--Mark Schupp


"Drew" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>I have the following simple conditional on my page,
>
> If EmpIDError <> 1 Then
> 'Show Input items
> End If
>
> Now I need to add another conditional to this,
>
> If PosIDError <> 1 Then
> 'Show input items
> End If
>
> So I made it like this,
>
> If EmpIDError <> 1 OR PosIDError <> 1 Then
>
> But the problem is that if PosIDError = 1, then it still shows the input
> items. But if I take the EmpIDError <> 1 out then it works with no
> problems. Why would this be like this?
>
> Thanks,
> Drew
>



 
Reply With Quote
 
Drew
Guest
Posts: n/a
 
      06-16-2005
Thanks! I must've had an extreme brain fart today!

Thanks a bunch!
Drew

"Mark Schupp" <(E-Mail Removed)> wrote in message
news:eO$(E-Mail Removed)...
> OR means that the if block should be executed if either condition is true
> so the only way that the code will not execute will be if both variables =
> 1. If you do not want the code to execute when any one of the variables =
> 1 you need to use AND.
>
> Also, make sure that the variables contain a numeric value (not a string
> containing a numeric). If you are not sure then include a conversion in
> the if statement.
>
> If CLng(EmpIDError) <> 1 OR CLng(PosIDError) <> 1 Then
>
> --
> --Mark Schupp
>
>
> "Drew" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>I have the following simple conditional on my page,
>>
>> If EmpIDError <> 1 Then
>> 'Show Input items
>> End If
>>
>> Now I need to add another conditional to this,
>>
>> If PosIDError <> 1 Then
>> 'Show input items
>> End If
>>
>> So I made it like this,
>>
>> If EmpIDError <> 1 OR PosIDError <> 1 Then
>>
>> But the problem is that if PosIDError = 1, then it still shows the input
>> items. But if I take the EmpIDError <> 1 out then it works with no
>> problems. Why would this be like this?
>>
>> Thanks,
>> Drew
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The giving that keeps on giving sixteenmillion C Programming 0 11-19-2007 10:59 PM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM
Ctl3dCtlColorEx function giving trouble maol ASP .Net 0 12-08-2004 03:08 AM
Giving Vonage voice packets priority with Cisco 1720 Albert Wiersch Cisco 0 05-14-2004 07:31 PM
Re: 'ThreadState' is giving problem ? Gaurav Khanna [.NET MVP] ASP .Net 0 07-25-2003 12:25 PM



Advertisments