EF无法将双精度转换为单精度此属性为“System.Single”类型的非空值。”db表结构是:QuoteIDuniqueidentifierUncheckedSubmissionDatedatetimeUncheckedRfqIDuniqueidentifierUncheckedSupplierIDuniqueidentifierUncheckedSupplierRefnvarchar(50)CheckedBomAmountExTaxdecimal(18,2)UncheckedBomAmountCurrencyIDintUncheckedBomAmountTaxRatefloatUncheckedBomTaxAmountdecimal(18,0)UncheckedExTaxdecimal(18,0)UncheckedExTaxdecimal(18,0)UncheckedExTaxdecimal(18,0)UncheckedExTaxdecimal(18,0)UncheckedExTaxdecimal(18,0)UncheckedExTaxdecimal(18,0),0)未检查的FreightAmountCurrencyIDint未检查的FreightAmountTaxRatefloat未检查的FreightTaxAmountdecimal(18,0)未检查的FreeFormParticularstextpublicclassEoiQuote{publicGuidQuoteID{get;放;}publicDateTimeSubmissionDate{get;放;}publicGuidRfqID{get;放;}publicGuidSupplierID{ge吨;放;}publicstringSupplierRef{get;放;}publicdecimalBomAmountExTax{get;放;}publicintBomAmountCurrencyID{得到;放;}publicfloatBomAmountTaxRate{get;}publicdecimalFreightAmountExTax{get;放;}publicintFreightAmountCurrencyID{得到;放;}publicfloatFreightAmountTaxRate{get;放;}publicdecimalFreightTaxAmount{get;放;;放;}publicDateTimeAvailabilityClosingDate{get;放;}publicintStatus{得到;放;}publicGuidTransactionID{get;放;}publicint数量{get;放;}publicDateTimeLastModified{get;放;}publicEoiQuote(){}}所以EF错误通常是绝对没有意义的float=float:对吗?SQL中的浮点数与.Net中的浮点数不同。查看SqlDbType枚举表,会发现SQLfloat相当于double类型。浮动>双。浮点数在-1.79E+308到1.79E+308范围内。来自C#参考:在.Net中,float是System.Single类型的别名。-3.4×1038到+3.4×1038以上就是C#学习教程:EF无法将double转single的全部内容。如果对大家有用,需要进一步了解C#学习教程,希望大家多加关注——本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
