Hi
I have a simple code which needs to add 2 decimals together but alas, it won't. The figures are stored on an SQL database (as a decimal). The site uses asp (vb script)
Lets pretend MaleHeight = 1.2 and FemaleHeight = 2.5
Line 5 (total = h1 + h2) gives me the error Type mismatch.
If I add cInt to h1 and h2, it does the maths but doesn't show the decimal place. The result is 3 instead of 3.7
However, if I add Response.Write( "h1= "& h1 &"") before line 5, the result is 1.2! I can't see why total can't add/display the result.
Any ideas?
I have a simple code which needs to add 2 decimals together but alas, it won't. The figures are stored on an SQL database (as a decimal). The site uses asp (vb script)
Lets pretend MaleHeight = 1.2 and FemaleHeight = 2.5
Code:
<%
dim h1, h2, total
h1 = rsPCB.Fields.Item("MaleHeight").Value
h2 = rsPCB.Fields.Item("FemaleHeight").Value
total = h1 + h2
Response.Write(total)
%>
If I add cInt to h1 and h2, it does the maths but doesn't show the decimal place. The result is 3 instead of 3.7
However, if I add Response.Write( "h1= "& h1 &"") before line 5, the result is 1.2! I can't see why total can't add/display the result.
Any ideas?
Comment