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
Expand|Select|Wrap|Line Numbers
- <%
- 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?