gpt4 book ai didi

mysql - Decimal(5, 1) MySql 数据类型

转载 作者:行者123 更新时间:2023-11-29 11:36:01 25 4
gpt4 key购买 nike

在其中一个表中,我使用的数据类型为decimal(5,1)。我看过这个reference 。它特别指出 D 是小数点右侧的位数(刻度)。范围为 0 到 30,且不得大于 M。

因此,表中 decimal(5,1) 类型的属性在我的 Create 上自动填充为 0.00我的网络应用程序中的页面。如果小数点右边只允许 1 位数字,那么两个“0”怎么可能?

最佳答案

得到答案,在我的模型中我需要做:

[Display(Name = "Total:")]
[DisplayFormat(DataFormatString = "{0:0.0}", ApplyFormatInEditMode = true)] /*Part I needed*/
[Required(ErrorMessage = "This field is required!")]
public decimal Total { get; set; }

关于mysql - Decimal(5, 1) MySql 数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36582163/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com