繁体   English   中英

LINQ-SQL一直要求money列为Single类型,即使它已经是

[英]LINQ-SQL keep requiring money column to be of type Single, even though it already is

我得到的错误是这样的:

The 'SalesValue' property on 'ItemSale' could not be set to a 'Decimal' value. 
You must set this property to a non-null value of type 'Single'.

但是我已经做到了:

[Table("ItemSales")]
public class ItemSale {
    [Key]
    public int ID { get; set; }
    ....
    public Single SalesValue { get; set; }
}

这是我的LINQ,非常简单:

            from x in database.ItemSales
            select x

我先使用实体​​框架代码

我该如何解决?

您检查过列类型的精度了吗? 这是我曾经遇到的一个错误,据我所记得,它与您的错误非常相似。 据我所记得,精度必须为2,但还有另一个值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM