A common error in programming with ASP Classic is the Overflow: ‘cInt’ error. What does it mean when you overflow a cInt value in ASP? How do you fix this?
First off, what is an int? An int is a commonly used number variable in ASP and in other languages. Int stands for integer, and it normally means a 32-bit number on 32-bit platforms. This means the number can be anywhere from
-2,147,483,648 to 2,147,483,647
That’s a pretty wide range!
Integers don’t have decimal points in them. They are just whole numbers. That makes the int variable perfect for loops and any other whole number operations.
On the other hand, the ASP function cInt() works on a much SMALLER group of numbers – only numbers from -32,768 to 32,767. So if you are ever counting up higher than 32,767 (or down below -32,768) you are going to run into trouble if you have to use cInt on that number.
If your numbers start getting beyond the standard range for cInt, try using the Int function instead. That usually works just as well. If it doesn’t, go for the cLng() function which works with longs instead.
It’s good, when you’re programming with ASP, to understand how these number ranges work. That way you can stay within your ranges.