|
 |
asp_database_setup thread: Fwd: cint overflow
Message #1 by "Mail List Management Account" <lists@m...> on Wed, 09 May 2001 06:34:12 -0400
|
|
I have now heard of the word "int" instead of "cint." Thanks anyway.
-----Original Message-----
From: "Mail List Management Account" <lists@m...>
To: asp_database_setup@p...
Date: Wed, 09 May 2001 05:54:47 -0400
Subject: cint overflow
Anyone who cares to help,
What is happening is that if I work with a 4-digit or less number, I have
no problem with calculations. Once I step up to 5 or more digits during
an update where the 4-digit number is subtracted from the running totals
and replaced with the updated 5-digit number, I get a cint overflow
error. The ".inc" file code is as follows:
*********** begin code **********
<%
rn = request.form("rn")
account = request.form("account")
location = request.form("location")
system = request.form("system")
value = request.form("value")
newval = request.form("value")
doc = request.form("doc")
nstep = request.form("nstep")
pcat = request.form("pcat")
plan = request.form("plan")
status = request.form("status")
cinfo = request.form("cinfo")
pmtotal1 = request.form("pmtotal")
pytotal1 = request.form("pytotal")
pcmtd = request.form("pcmtd")
pcytd = request.form("pcytd")
set pq = server.createobject("adodb.recordset")
pq.open "select * from prospects where index=" & cint(rn), connection,
adopenkeyset, adlockoptimistic
if not pq.eof then
mor = pq("mor")
yor = pq("yor")
pmyor = mor & ", " & yor
pq("account") = account
pq("location") = location
pq("system") = system
oldval = pq("value")
pq("value") = newval
pq("doc") = doc
pq("nstep") = nstep
pq("pcat") = pcat
prob = pq("prob")
pq("plan") = plan
pq("status") = status
pq("cinfo") = cinfo
oldprobcalc = pq("probcalc")
probcalc = cint(newval) * prob
pq("probcalc") = probcalc
pq.update
pq.close
set pq = nothing
pmtotal = pmtotal1 + cint(newval) - oldval
pytotal = pytotal1 + cint(newval) - oldval
set conv = server.createobject("adodb.recordset")
conv.open "select pcmtd, pcytd, pmtotal, pytotal, pmval, pyval from logon
where fn='" & fn & "'", connection, adopenkeyset, adlockoptimistic
if not conv.eof then
pcmtd = conv("pcmtd")
pcytd = conv("pcytd")
oldpmval = conv("pmval") - cint(oldprobcalc)
oldpyval = conv("pyval") - cint(oldprobcalc)
pmval = oldpmval + cint(probcalc)
pyval = oldpyval + cint(probcalc)
conv("pmtotal") = pmtotal
conv("pytotal") = pytotal
conv("pmval") = pmval
conv("pyval") = pyval
conv.update
conv.close
set conv = nothing
else
end if
connection.close
set connection = nothing
else
pq.close
set pq = nothing
connection.close
set connection = nothing
response.write "Something has gone wrong. Please email software
technical support."
end if
%>
************** end code ***********
Thanks....noting that the calcs above are nothing but addition and
subtraction. I have a few other screens where multiplication, division
as well as addition and subtraction are in the same line of code and they
work fine. I am stumpped as to the proper manner in which to use numbers
in ASP. The rules seem to change on every calculation I do. Help
please!!!
===================================
Custom Web Application Programming
Contact: was@i...
===================================
Your Message Here
20,000 messages for $39.00
Contact: lists@m...
===================================
Message #2 by "simon ryan" <sjr100@c...> on Tue, 29 May 2001 08:49:58
|
|
> Have you tried using CLng to cope with larger numbers?
Simon Ryan
I have now heard of the word "int" instead of "cint." Thanks anyway.
>
> -----Original Message-----
> From: "Mail List Management Account" <lists@m...>
> To: asp_database_setup@p...
> Date: Wed, 09 May 2001 05:54:47 -0400
> Subject: cint overflow
>
> Anyone who cares to help,
>
> What is happening is that if I work with a 4-digit or less number, I have
> no problem with calculations. Once I step up to 5 or more digits during
> an update where the 4-digit number is subtracted from the running totals
> and replaced with the updated 5-digit number, I get a cint overflow
> error. The ".inc" file code is as follows:
>
> *********** begin code **********
> <%
> rn = request.form("rn")
> account = request.form("account")
> location = request.form("location")
> system = request.form("system")
> value = request.form("value")
> newval = request.form("value")
> doc = request.form("doc")
> nstep = request.form("nstep")
> pcat = request.form("pcat")
> plan = request.form("plan")
> status = request.form("status")
> cinfo = request.form("cinfo")
> pmtotal1 = request.form("pmtotal")
> pytotal1 = request.form("pytotal")
> pcmtd = request.form("pcmtd")
> pcytd = request.form("pcytd")
>
> set pq = server.createobject("adodb.recordset")
> pq.open "select * from prospects where index=" & cint(rn), connection,
> adopenkeyset, adlockoptimistic
>
> if not pq.eof then
> mor = pq("mor")
> yor = pq("yor")
> pmyor = mor & ", " & yor
> pq("account") = account
> pq("location") = location
> pq("system") = system
> oldval = pq("value")
> pq("value") = newval
> pq("doc") = doc
> pq("nstep") = nstep
> pq("pcat") = pcat
> prob = pq("prob")
> pq("plan") = plan
> pq("status") = status
> pq("cinfo") = cinfo
> oldprobcalc = pq("probcalc")
> probcalc = cint(newval) * prob
> pq("probcalc") = probcalc
> pq.update
> pq.close
> set pq = nothing
>
> pmtotal = pmtotal1 + cint(newval) - oldval
> pytotal = pytotal1 + cint(newval) - oldval
>
> set conv = server.createobject("adodb.recordset")
> conv.open "select pcmtd, pcytd, pmtotal, pytotal, pmval, pyval from logon
> where fn='" & fn & "'", connection, adopenkeyset, adlockoptimistic
>
> if not conv.eof then
> pcmtd = conv("pcmtd")
> pcytd = conv("pcytd")
> oldpmval = conv("pmval") - cint(oldprobcalc)
> oldpyval = conv("pyval") - cint(oldprobcalc)
> pmval = oldpmval + cint(probcalc)
> pyval = oldpyval + cint(probcalc)
> conv("pmtotal") = pmtotal
> conv("pytotal") = pytotal
> conv("pmval") = pmval
> conv("pyval") = pyval
> conv.update
> conv.close
> set conv = nothing
> else
> end if
>
> connection.close
> set connection = nothing
> else
> pq.close
> set pq = nothing
> connection.close
> set connection = nothing
> response.write "Something has gone wrong. Please email software
> technical support."
> end if
> %>
> ************** end code ***********
>
> Thanks....noting that the calcs above are nothing but addition and
> subtraction. I have a few other screens where multiplication, division
> as well as addition and subtraction are in the same line of code and they
> work fine. I am stumpped as to the proper manner in which to use numbers
> in ASP. The rules seem to change on every calculation I do. Help
> please!!!
|
|
 |