[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Can't prevent rounding in gridbox

=?Utf-8?B?cm9kY2hhcg==?=

2/16/2004 5:51:00 AM

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
1 Answer

=?Utf-8?B?cm9kY2hhcg==?=

2/18/2004 7:51:00 PM

0

Take a look at thi
http://www.dotnetjunkies.com/Tutorial/3826C8F8-207E-403E-AE4A-A841A4...
I think that the {0:C} may be your issue.