How to display values only upto 2 decimal places

后端 未结 8 2355
南旧
南旧 2020-12-17 19:04

I have a table column \"Amount\" of type money. When I am retrieving its value through a store procedure, it returns the value upto 4 decimal places(because of type money).

8条回答
  •  北海茫月
    2020-12-17 19:33

    Read Custom Numeric Formats for detailed instructions on formatting numbers.

    value.ToString("0.00");
    

    In C# 6 or later, you can use string interpolation for a somewhat cleaner syntax.

    $"{value:0.00}";
    

提交回复
热议问题