I am very new to asp and having following problem
I am getting 2 values from 2 column, from database and when i try to multiply them, its giving following error
Error Type:
(0x80020009)
Exception occurred.
This is my code
totalPrice = totalPrice + rs("ProductQunaity") * rs("ProductPrice")
Even if someone can tell me what should be "Title" of this question, that would be great.
In case the error that amphetamachine pointed out is only in your code here at SO and not in the original code, please make sure that you don't have any type errors ( ;) ) with the values either.
totalPrice = totalPrice + CInt(rs("ProductQuantity")) * CDbl(rs("ProductPrice"))
where CInt()
converts a value to an integer, and CDbl()
converts a value to a double.
However, if you're very new to ASP, I'd recommend going straight to ASP.NET - ASP is a technology that hasn't developed in the last decade, while ASP.NET is Microsoft's new, fully supported (and pretty awesome) web development platform.
I'd recommend you start with ASP.NET MVC, since it is usually a lot cleaner, and it's straightforward to output the html you want. This and this are two good places to start.
Are you sure you typed that correctly?
# (what's this?) ---v
totalPrice = totalPrice + rs("ProductQunaity") * rs("ProductPrice"`)
Whenever you have errors like this, the best way to debug them is to response.write all the values out, then response.end before the line throwing the error is run. You can then inspect the values and attempt to work out why they are not compatible.
User contributions licensed under CC BY-SA 3.0