Forums
This topic is locked
Calculate with asp variables
12 Jul 2010 18:27:31 sofie sof posted:
Hi,In my ms sql database i have 2 numeric fields.
I declared 2 variables and a calculation :
Brutto = (Producten.Fields.Item("BruttoPrijs".Value)
Netto = (Producten.Fields.Item("NettoPrijs".Value)
Winst = Brutto - Netto
I get a code error.
This is my code in asp vbscript:
<%
Brutto = (Producten.Fields.Item("BruttoPrijs".Value)
Netto = (Producten.Fields.Item("NettoPrijs".Value)
Winst = Brutto - Netto
%>
Help is very welcome.
Tx,
Peter
Replies
Replied 13 Jul 2010 11:50:12
13 Jul 2010 11:50:12 Patrick Woldberg replied:
I don't know the error you get, but try converting the values to Double first.
Brutto = CDbl(Producten.Fields.Item("BruttoPrijs").Value) Netto = CDbl(Producten.Fields.Item("NettoPrijs").Value) Winst = Brutto - Netto