开发者

Problem in displaying float value in label from Database:

开发者 https://www.devze.com 2023-03-16 00:45 出处:网络
I have stored 1000.5 value (datatype float)in database.. but when i am retrieving that value and displaying in label. so it displays like 1000.04998779297..

I have stored 1000.5 value (datatype float) in database.. but when i am retrieving that value and displaying in label. so it displays like 1000.04998779297..

what shou开发者_Go百科ld i do?

thnx


You need to format the value ...

String.Format("{0:0.0}", 123.43543545);

Result:

123.4


Check String Format for Double [C#]


You can also do using

Convert.ToDouble(dt.rows[0][0]).ToString("0.00");
0

精彩评论

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