[英]C# How to Format currency in Reportviewer with Commas and Decimals
How do i format currency with Commas and Decimals in Reportviewer? 如何在Reportviewer中使用逗号和小数格式化货币? in C# ? 在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. 我想要这样的东西: 1,23456.00
非常新。
=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. 我发现,如果在ReportViewer的SQL查询中强制转换/格式化数据,这通常是最简单的。
SELECT FORMAT(Balance, 'C', 'en-us') AS 'Balance'
(where Balance
is your column or value) SELECT FORMAT(Balance, 'C', 'en-us') AS 'Balance'
(其中Balance
是您的列或值)
Note that if your column or value is a VARCHAR then you'll need to CAST
it to a float first: 请注意,如果您的列或值是VARCHAR,则需要先将其CAST
转换为float:
SELECT FORMAT(CAST(Balance AS float), 'C', 'en-us') AS 'Balance'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.