ASP Error - Overflow: 'cInt'

ASP Error - Overflow: 'cInt'
A common error in ASP is the Overflow: 'cInt' error. What does it mean when you overflow a cInt value? 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.

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2022 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.