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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

darn asp

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
0
0
BE
Hi,

I want to compare a value in a field with a value in my recordset and I got something like this:

if (Request.Form("test") > Cstr(CInt(oRS9(2)))) then
...
end if

I know that there is something wrong with Cstr(CInt(oRS9(2))) because if the value in oRS9(2) is eg 15 he takes only the 1 to compare with "test". And if it is eg 35 he takes the 3 ... so can someone help me with this?

thanx

p.s. oRS2(9) is a smallInt
 
If it's a number field you are trying to compare, then use this...

dim theNum
theNum = oRS9(2))

if cint((Request.Form("test")) > theNum then

I don't know why it would be truncating your number like that with what you had above -- Sometimes I have problems evaluating a number read straight from the recordset, but I couldn't tell you why -- and so I fix the problem by reading the number into a variable, and then evaluating that.

good luck! :)
Paul Prewett

 
I should qualify the above by saying that if your user doesn't enter a number in that form field that you are requesting, and it's strictly a string value, then it's gonna raise an error, so you'll probably need to do some form validation on the page that it's sending from to ensure your users don't get a nice vbscript error.

:)
 
thank you for the information, it works ... and also thanks for that second message, but I already knew it :p ... see you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top