View Full Version : Rounding up two decimal places

11-12-2010, 10:44 AM
hi guys,

I have the following bit of code:

Decimal retCut = rrp * retailerCut;
Decimal edcut = rrp * edpercentage;

All are of type decimal, and what I'm trying to do is round the number UP to two decimal places.

Currently I get the following:

retCut = 3.145
edCut = .3455

I have tried performing the Math.Round() - (Math.Round(edCut, 2) ) - function on them however it doesn't seem to b working. I inserted a break point in my code and it didn't seem to perform any action at all on these figures.
I'm inserting these figures into a database column of type Decimal(18, 2) so as a result of the figures not rounding up, I am losing cents on every entry. These can build over over time. Can anyone point me in the right direction?

11-12-2010, 02:53 PM
Use Decimal.Round to get the correct number.