[英]Can not assign value for textbox in backgroundworker (c# winform)
[英]C# Winform Textbox Numeric Value
在我的 SQL 数据库中,我有一个表
(Product)
(
Item nvarchar(50),
Price real
)
在我的 C# winform 应用程序中,我有这个表的 class object
class Product
{
string Item;
double Price;
}
using binding source, I bind the text property of textbox1.text to Product.Item
and
textbox2.text to Product.Price.
data in my table in the database is as follows,
Item = Item1
Price = 90.53
当我的应用程序中表示相同的数据并绑定到我的两个文本框时,textbox1.text = Item1(这里没有问题)但 textbox2.text = 90.529998779296875 而不是 90.53。
我无法弄清楚是什么让数据库中的 90.53 在我的文本框中表示为 90.529998779296875?
在 SQL 中使用货币数据类型解决了这个问题,现在我总是得到数据库中保存的确切数字
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.