gpt4 book ai didi

c# - Convert.ToDouble() 溢出 SqlDataReader 值

转载 作者:太空宇宙 更新时间:2023-11-03 10:44:37 25 4
gpt4 key购买 nike

Convert.ToDouble(rdr["value"]) 

当 SQL Server 中显示的值为 75875563.7000000000000000000000 时引发“转换溢出”错误。

enter image description here

堆栈跟踪:

   at System.Data.SqlClient.SqlBuffer.get_Decimal()
at System.Data.SqlClient.SqlBuffer.get_Value()
at System.Data.SqlClient.SqlDataReader.GetValueFromSqlBufferInternal(SqlBuffer data, _SqlMetaData metaData)
at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i)
at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)
at DataAPI.Models.Title.TitleDB.getTitlePerformance(Nullable`1 StartDate, Nullable`1 EndDate) in c:\00 BI Source\BIPortal\DataAPI\DataAPI\Models\Title\TitleDB.cs:line 44

谁能告诉我这是为什么?

最佳答案

这是关于小数容量的。你可以在 sql server 端使用 decimal (16,4) (或者你需要的一些精度)吗? decimal(16,4)表示16个字符,4个数字,

关于c# - Convert.ToDouble() 溢出 SqlDataReader 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23941401/

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