Can't prevent rounding in gridbox

D

Dave Uphoff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top