Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange results with comparision of Session var and rcs.getcount

Status
Not open for further replies.

crystalized

Programmer
Jul 10, 2000
390
CA
I have a function that contains the following snippet of code

Code:
currCount=rcs.getCount()
numAvailable=Session.contents("maxEmp")

if currCount<numAvailable then
      available=true
end if

Now my problem is that if I output the values I get
currCount=3
numAvailable=1

But my test keeps coming back as true. I can not figure this out for the life of me. I keep getting the wrong result.

Is there some kind of problem with comparing the session variables and getCount values. I am absolutely at a loss. I have been playing around with this thing for the last 2 hours and I just can't seem to spot a problem with it.

I have tried converting both values using the CInt function, that did not make any difference. The only thing I could think of is that one of the values is somehow being interpreted as a different data type than the other (say one is being interpreted as a string and the other as an integer).

Help (and why isn't there an emoticon with a person pulling their hair out X-) )
 
Well I just tried using the CLng function on each of the values.

Like this

Code:
currCount=CLng(rcs.getCount())
numAvailable=CLng(Session.contents(&quot;maxEmp&quot;))

And this seems to have corrected my problem.

If anyone has any insights on this I would still be interested in hearing them.
 
You are dealing with a type conversion problem... asp is a pain in the @#$ when it comes to types... all things being variant... if you know it should be a number do your best to use cint(expression) or clng(expression) to avoid that problem... because it is speratic... at best...
Chad
tinman@thelandofoz.org

Tinman,

Welcome to OZ.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top