|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
how to sum up values stored in sessions
<i><b>Originally posted by : witold (wsokolow@poczta.onet.pl)</b></i><br />hi,<br /><br />i store values in several sessions e.g.<br /><br />session("item1") = "10"<br />session("item2") = "15"<br />session("item3") = "20"<br /><br />i need to add all the values up and get something like<br /><br />session("total") = session("item1") + session("item2")+ session("item3")<br /><br />i should end up with session("total") = "45" but<br />instead I get session("total") = "101520"<br /><br />Can anyone help me?<br /><br />witold<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Kurt (Kurt.Vandevelde@CMG.Be)</b></i><br />When you use Session("Item1"), the result is considered as a string. <br />Try<br />session("total") = CInt(session("item1")) + CInt(session("item2"))+ CInt(session("item3"))<br /><br />Kurt<br />------------<br />witold at 2/26/2002 4:04:18 AM<br /><br />hi,<br /><br />i store values in several sessions e.g.<br /><br />session("item1") = "10"<br />session("item2") = "15"<br />session("item3") = "20"<br /><br />i need to add all the values up and get something like<br /><br />session("total") = session("item1") + session("item2")+ session("item3")<br /><br />i should end up with session("total") = "45" but<br />instead I get session("total") = "101520"<br /><br />Can anyone help me?<br /><br />witold<br />
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : witold (wsokolow@poczta.onet.pl)</b></i><br /><br />Thanks. One of my work colleagues has already prompted me with this solution. That's it!<br />It can be either cint(session("item1")) or<br />cint(request.form("item1")).<br /><br />Imagine I spent half a day looking for it and the answer's so simple:-)<br /><br />witold<br /><br />------------<br />Kurt at 2/26/2002 7:26:59 AM<br /><br />When you use Session("Item1"), the result is considered as a string. <br />Try<br />session("total") = CInt(session("item1")) + CInt(session("item2"))+ CInt(session("item3"))<br /><br />Kurt<br />------------<br />witold at 2/26/2002 4:04:18 AM<br /><br />hi,<br /><br />i store values in several sessions e.g.<br /><br />session("item1") = "10"<br />session("item2") = "15"<br />session("item3") = "20"<br /><br />i need to add all the values up and get something like<br /><br />session("total") = session("item1") + session("item2")+ session("item3")<br /><br />i should end up with session("total") = "45" but<br />instead I get session("total") = "101520"<br /><br />Can anyone help me?<br /><br />witold<br />
|
|
#4
|
|||
|
|||
|
<i><b>Originally posted by : Andres Melguizo Velez (lucan@bigfoot.com)</b></i><br />The answer is ok! Just be careful with the kind of data that you are using, CInt() works with Integer values and you could need CDbl() for bigger or float values.<br /><br /><br />------------<br />witold at 2/26/2002 7:42:52 AM<br /><br /><br />Thanks. One of my work colleagues has already prompted me with this solution. That's it!<br />It can be either cint(session("item1")) or<br />cint(request.form("item1")).<br /><br />Imagine I spent half a day looking for it and the answer's so simple:-)<br /><br />witold<br /><br />------------<br />Kurt at 2/26/2002 7:26:59 AM<br /><br />When you use Session("Item1"), the result is considered as a string. <br />Try<br />session("total") = CInt(session("item1")) + CInt(session("item2"))+ CInt(session("item3"))<br /><br />Kurt<br />------------<br />witold at 2/26/2002 4:04:18 AM<br /><br />hi,<br /><br />i store values in several sessions e.g.<br /><br />session("item1") = "10"<br />session("item2") = "15"<br />session("item3") = "20"<br /><br />i need to add all the values up and get something like<br /><br />session("total") = session("item1") + session("item2")+ session("item3")<br /><br />i should end up with session("total") = "45" but<br />instead I get session("total") = "101520"<br /><br />Can anyone help me?<br /><br />witold<br />
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > how to sum up values stored in sessions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|