开发者

How to retrieve datas from access Database to Datagridview

开发者 https://www.devze.com 2022-12-29 13:59 出处:网络
I have datas as unitprice with 10 decimal places in access database. I want those decimal places to reduce when it comes t开发者_运维问答o datagridview(round to 2 places).

I have datas as unitprice with 10 decimal places in access database. I want those decimal places to reduce when it comes t开发者_运维问答o datagridview(round to 2 places). How can i achieve this. Any idea.

Thanks in advance


You could round it when retrieving it, but I would recommend to round only the displayed value (because you might need the original value for some calculus).

So here is how you format the first column to round to 2:

grid.Columns(0).DefaultCellStyle.Format = "D2";

0

精彩评论

暂无评论...
验证码 换一张
取 消