Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI all,,

I am having three long variables in which I m storing some value.. and i want to check statement base on that ..i.e.

if all three values are zero that further processing will be done.. but issue is that when I try to use && (AND OPERATOR) between them, compiler shows not supported for int & long... SO can you guyes tell me some solution for this???


Regards,,


:)
Posted
Comments
Rajeshkumar Ramasamy 24-May-13 2:22am    
Put your code here.

Solved Myself with following... :)


C#
if ((variable1== null || variable1== "0") && (variable2== null || variable2== "0") && (variable3== null || variable3== "0"))
      {
          Response.Write("You have not selected any checkbox!!!");

      }
 
Share this answer
 
Comments
Richard MacCutchan 24-May-13 3:35am    
You have tagged your question C++ and C#, but this code looks more like Javascript.
lukeer 24-May-13 4:17am    
<quote>long variables...<quote>not supported for int & long
Neither an int nor a long can ever be null. Nor can any of these be tested for equality against a string literal.

Sort your question out (use the "Improve question" link for that).
Check against 0L instead of just 0.
That way, the zero is interpreted as of type long itself and therefore there should be no type mismatch between an integer and a long anymore.
 
Share this answer
 
v2
Comments
VICK 24-May-13 2:56am    
Still Showing

Operator '&&' cannot be applied to operands of type 'string' and 'long'... :(
lukeer 24-May-13 4:14am    
Where does that 'string' come from?
In your question, you're talking about 'long' and 'int'. So if this solution doesn't work for you, do as Rajeshkumar Ramasamy told you and post your code.

That's what the "Improve question" link is for. Use it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900