| |
LITTLERIC
Posts: 2
Score: 0
Joined: 10/26/2006
Status: offline
|
Sometimes you can store a form value in session and it will work, but as you suggested, casting is usually good before doing calc's. With something like using the variable in a query string it doesn't matter because the query is a text string....but going the other way is tougher. Reading a value from a form that comes back as 5 may not be the same on a compare when you match it with a database integer value of 5 ... until you do the casting. That can be done with something like yournum = CInt(Request.Form("thefield")) or yournum = CLng(Request.form("thefield")) I have a function I use for doing that because sometimes you get burned with nulls, empty strings, etc. Function checks for numeric and passes back 0 if it fails; otherwise does the cast into a Long Integer. You'll probably find having that in some kind of core library would be helpful! Good luck!
|
|