I have started getting this error on our production web server (Windows 2003
running IIS6). I don't get the error on my Notebook (XP SP2).
The official error is "Overflow" but I have tried every variation I can
think of to ensure there is no actual overflow.
The code is as follows:
<%@ LANGUAGE="VBSCRIPT" %>
<!-- #INCLUDE FILE="../security.inc" -->
<script language="VBScript" RUNAT=SERVER>
Function CalcPremium(pState, pValue)
Select Case pState
Case "ACT", "NSW", "VIC", "TAS"
currRate = CDbl(0.0028)
currMin = 220
Case "QLD", "SA"
currRate = CDbl(0.0024)
currMin = 220
End Select
currPremium = CDbl(pValue * currRate)
If currPremium < currMin Then
currPremium = currMin
End If
CalcPremium = CLng(currPremium)
End Function
</Script>
<%
Dim currContractValue
Dim currPremium
LogVisit Session("MemberID"), "InsuranceCalc"
strMsg = ""
If Request("SubmitBack") = "Return to Insurance Page" then
Response.Redirect "construction.asp"
End If
If Not IsEmpty(Request("ContractValue")) Then
If Not IsNumeric(Request("ContractValue")) Then
currContractValue = Null
strMsg = "Please enter a number as the Contract Value"
else
currContractValue = CLng(Request("ContractValue"))
End If
else
currContractValue = Null
strMsg = "Please enter a Contract Value"
End If
If IsEmpty(Session("CalcState")) or IsNull(Session("CalcState")) Then
strState = Session("MemberState")
else
strState = Request("State")
End If
Session("CalcState") = strState
If strMsg = "" then
currPremium = CalcPremium(strState, currContractValue)
strMsg = "ContractValue = $" & currContractValue & "; State = " & strState
& "; Premium = " & FormatCurrency(currPremium,2)
End If
%>
In this version the error occures on line 15 which is:
currPremium = CDbl(pValue * currRate)
I have explicitly converted pValue to a Long and currRate to a Double.
What is also strange (apart from it working fine on my development machine),
is that it actually calculates OK every second refresh. i.e.
1. Refresh - error
2. Refresh - OK
3. Enter new value or just Submit again - error
4. Refresh - OK
Does anyone have any clues? I suspect it is a bug or setting in IIS.
--
Kevin Seerup
GoalMaker Pty Ltd
http://www.goalmaker.com