[thelist] ASP: DIM var AS ??

Stephen Caudill SCaudill at municode.com
Wed Jul 2 16:36:52 CDT 2003


Casey Crookston bespaketh on Wednesday, July 02, 2003 4:39 PM:

> Hello Listers,
> 
> Question: what is the syntax to define a variable as an integer?
> 
> I have a VERY simple if then statement:
> 
> if cat = cat_id then
>    klass="navigation2"
> else
>    klass="navigation"
> 
> Weird thing... ONLY the "else" gets triggered, even when cat and
> cat_id are equal.  I have checked and double checked (even
> response.wrote the two vars
> to the screen) but for what ever reason klass will never be equal to
> "navigation2".  Ever.  Even when cat = cat_id.
> 
> About the only thing I can figure is that cat is being defined as a
> string and cat_id as a number (or vise versa).  So I need to know how
> to specifiy that both are integers.
> 
> Thanks,
> 
> Casey

Casey,
  You're dead right. if you request like so:
request.form(cint("cat"))
it'll straighten you right out.  here's a link to the description of cint:
http://www.devguru.com/Technologies/vbscript/quickref/cint.html
you can also clng, cdbl, cbool, etc.  check out the functions page for vbscript on devguru.com

hth,
Stephen
http://www.mechavox.com


More information about the thelist mailing list