Can't prevent rounding in gridbox

Discussion in 'ASP .Net Web Controls' started by Dave Uphoff, Feb 16, 2004.

  1. Dave Uphoff

    Dave Uphoff Guest

    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
     
    Dave Uphoff, Feb 16, 2004
    #1
    1. Advertising

  2. Dave Uphoff

    Barry Guest

    Barry, Feb 18, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walala
    Replies:
    12
    Views:
    1,948
  2. valentin tihomirov

    rounding to integer

    valentin tihomirov, Feb 15, 2004, in forum: VHDL
    Replies:
    2
    Views:
    10,021
    Jonathan Bromley
    Feb 16, 2004
  3. C

    Rounding Numbers

    C, Aug 25, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    516
  4. iksrazal
    Replies:
    1
    Views:
    747
    Chris Smith
    Jul 3, 2003
  5. Mr. Ken
    Replies:
    2
    Views:
    667
    Tomás
    May 25, 2006
Loading...

Share This Page