Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-01-2002, 07:55 AM   PM User | #1
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
overflow?

I'm making a small calculator project which will write the amount of fence posts needed for a fence on my parents farm depending on the input from the form. .

Here is what I'm using.
Code:
<%
dim PostNo  'The variable for the number of posts
dim PostSp  'The variable for spacing between posts
dim PaceAm 'The variable for the amount of paces
dim PaceSz  'The variable for the size of the paces

PostSp  = Request.Form("fPostSp")
PaceAm = Request.Form("fPaceAm")
PaceSz  = Request.Form("fPaceSz")

PostNo = PaceAm*PaceSz/PostSp

Response.Write(PostNo)
%>
I get an error stating overflow. What does it mean? Is it that the variable has to much information?
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 08-01-2002, 08:10 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
what's the expected value of PostNo?
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 08-01-2002, 08:24 AM   PM User | #3
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
Not quite clear on what you mean.
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 08-01-2002, 08:29 AM   PM User | #4
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
when you ran the code, what is supposed to be the value of PostNo variable, is it too big?
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 08-02-2002, 08:30 AM   PM User | #5
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
PostNo is supposed to hold the result of the calculation.
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 08-02-2002, 08:37 AM   PM User | #6
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
I've tried multiple ways but I can seem to devide the number which I have stored in a variable.

Simply I times two numbers together and then divide the answer but I get an overflow error when I try to divide.
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 08-02-2002, 02:47 PM   PM User | #7
allida77
Regular Coder

 
Join Date: Jun 2002
Location: Cincinnati, OH
Posts: 545
Thanks: 0
Thanked 0 Times in 0 Posts
allida77 is an unknown quantity at this point
Is it just an "overflow" error, try putting an --> On Error Resume Next at the beginning of your code.
allida77 is offline   Reply With Quote
Old 08-02-2002, 10:28 PM   PM User | #8
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
This is the page I made up and it appears to work. I added some validation in because without it, if one of the variables is empty it errors out.

Code:
<HEAD>
<TITLE>Fence post calculator</TITLE>
</HEAD>

<BODY>

<p>
<FORM action="" Method="Post">
Spacing between posts:<INPUT type="text" name="fPostSp"><BR>
Ammount of paces:<INPUT type="text" name="fPaceAm"><BR>
Size of paces:<INPUT type="text" name="fPaceSz"><BR><BR>

<INPUT type="Submit" value="Calculate">
</FORM>
</p>

<%
dim PostNo  'The variable for the number of posts
dim PostSp  'The variable for spacing between posts
dim PaceAm 'The variable for the amount of paces
dim PaceSz  'The variable for the size of the paces

PostSp  = Request.Form("fPostSp")
PaceAm = Request.Form("fPaceAm")
PaceSz  = Request.Form("fPaceSz")

If PostSP > 0 And PaceAm > 0 And PaceSz > 0 Then

PostNo = PaceAm*PaceSz
PostNo=PostNo/PostSp
%>

<p><%=PostNo%> required posts.</p>
<%End If%>

</BODY>
__________________
OracleGuy

Last edited by oracleguy; 08-03-2002 at 12:44 AM..
oracleguy is offline   Reply With Quote
Old 08-02-2002, 11:22 PM   PM User | #9
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
But actually doing <p><%=PostNo%> required posts.</p> is much more entertaining than the long way

Are you trying to cast a number larger than 32,000 to an integer?

I've had similar problems when dealing with regional settings for decimal seperators and the thousands, but that doesn't seem to be the case for you...

Usually you get this error when you are over the limit on Request.Form. ASP's limit for form processing is supposed to be about 100k, according to Micro$oft, it breaks down further to a max of 102,399 bytes for each field. Which, again, doesn't seem like it should be affecting you, depending on what you are sending into the form...if it is the case, however, you can always use the old dirty trick of using your own function to deal with the form handling and therefore get around the overflow fatality.
__________________
Moderator, Perl/CGI Forum
shadowstorm.net - subvert society
Feyd is offline   Reply With Quote
Old 08-03-2002, 12:43 AM   PM User | #10
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Quote:
Originally posted by Feyd
But actually doing <p><%=PostNo%> required posts.</p> is much more entertaining than the long way
I usually do that... i did it that way cuz i was "adapting" his existing code. I'll change it.
oracleguy is offline   Reply With Quote
Old 08-08-2002, 12:27 AM   PM User | #11
whammy
Senior Coder

 
Join Date: Jun 2002
Location: 41° 8' 52" N -95° 53' 31" W
Posts: 3,660
Thanks: 0
Thanked 0 Times in 0 Posts
whammy is an unknown quantity at this point
Probably if you used some parentheses the first way would work, too.
__________________
Former ASP Forum Moderator - I'm back!

If you can teach yourself how to learn, you can learn anything. ;)
whammy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:48 PM.


Advertisement
Log in to turn off these ads.