C# Currency to string

后端 未结 10 2823
旧巷少年郎
旧巷少年郎 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:23

    string value = (Convert.ToDecimal(ReturnValue)).ToString("c");
    

    c is for currency p for percentage. There is a list of other letters you can use.

提交回复
热议问题