简体   繁体   中英

C# How to Format currency in Reportviewer with Commas and Decimals

How do i format currency with Commas and Decimals in Reportviewer? in C# ? I have been looking up and i have not seen something that does make some sense here

I have a Field called balance now i want to do something like this

=Format(CDec(balance.Value),"N")

I want to have something like this : 1,23456.00 Very new to this.

In the design view. Right click in the field. Click on the properties. A new window will popup. There pick number on left side and do your formatting.

第一步

第二步

=FormatCurrency(balance.Value, "en-US", 2)

I've found that it's usually easiest if you cast/format the data in the SQL Query for the ReportViewer.

SELECT FORMAT(Balance, 'C', 'en-us') AS 'Balance' (where Balance is your column or value)

Note that if your column or value is a VARCHAR then you'll need to CAST it to a float first:

SELECT FORMAT(CAST(Balance AS float), 'C', 'en-us') AS 'Balance'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM