C# Currency to string

后端 未结 10 2861
旧巷少年郎
旧巷少年郎 2021-02-19 10:52

I am querying a database field that returns a money value, I am assigning this to a string but it is adding extra 00 on the end.

e.g. Query returns 30.00

10条回答
  •  孤街浪徒
    2021-02-19 11:35

    My recommendation is to convert it to Decimal firstly. I'd use something like this:

    string value = (Convert.ToDecimal(ReturnValue)).ToString("0,0.00");
    

提交回复
热议问题