Problem in displaying float value in label from Database:
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");
精彩评论