Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Can't prevent rounding in gridbox

Thread Tools

Can't prevent rounding in gridbox

Dave Uphoff
Posts: n/a
When I make a change to a numeric field in a gridbox on an Update Command, the results are always rounded to the nearest dollar and always shows 2 decimal places of zeros even though I put in cents. My code for capturing the data is shown below:

System.Globalization.NumberStyles style = new System.Globalization.NumberStyles();
style = System.Globalization.NumberStyles.Any;
decimal amountowed = System.Decimal.Parse(tb.Text, style);

The code for updating the data is: cmd.Parameters.Add("@AmountOwed", OleDbType.Decimal);
cmd.Parameters["@AmountOwed"].Value = amountowed;

The amountowed variable shows the correct value before the update occurs but it still displays .00 for the cents on the gridbox.
I've tried using long an double also. My edit mask is {0:C} in the Property Builder and the field is defined as long with 2 decimal places in my Access data base. Anyone have any clues?
Dave Uphoff
Reply With Quote
Posts: n/a
Take a look at thi
I think that the {0:C} may be your issue.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting a number without rounding Thor W Hammer ASP .Net 2 11-22-2005 06:51 PM
rounding to integer valentin tihomirov VHDL 2 02-16-2004 10:07 AM
will Synposys Design Compiler support division by two's power and integer rounding? walala VHDL 12 09-14-2003 03:49 PM
Rounding Numbers C ASP .Net 2 08-25-2003 03:24 PM
prevent rounding with Number.floatValue() ? iksrazal Java 1 07-03-2003 07:02 PM