数值太大,无法容纳96位小数 [英] "The numerical value is too large to fit into a 96 bit decimal
本文介绍了数值太大,无法容纳96位小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有一个问题,我要通过执行查询从sql绑定表
Hello,
I have an issue in which I am binding a table from sql by executing query
select * from test
在此表中,数据采用以下格式:
in this table the data are in this format :
Id Name Details
1 dinesh 987654312.00000000000000000000
2 sandeep 987654312.00000000000000000000
3 neha 987654312.00000000000000000000
4 sunil 987654312.00000000000000000000
但是我绑定了它,然后它显示错误为
数值太大,无法容纳96位十进制."
表的列的数据类型如下:-
but wen i am binding it then its displaying error as
"The numerical value is too large to fit into a 96 bit decimal."
The Datatype of columns of Table is as follows:-
Name DataType Allow null
Id nchar(10) Checked
Name nchar(10) Checked
Amount numeric(38, 20) Checked
我编写的代码如下:-
Code which I have written is as follows:-
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(tmpquery, ConnectionString)
Dim dt As New DataSet
da.Fill(dt)
请帮助我.....
Please help me.....
推荐答案
问题是您在SQL中指定了38位数字字段,而.NET中的十进制字段仅为28 /29位数字.因此,当您读回它时,会收到错误消息.如果可以的话,请将SQL字段的大小减小到28位,然后问题就会消失.
The problem is that you are specifying a 38 digit numeric field in SQL, where the decimal field in .NET is only 28/29 digits. So when you read it back, you get the error. If you can, reduce the size of your SQL field to 28 digits and the problem should go away.
可以支持这样的值的仅有的两种数据类型是Single和Double,尽管您可以"会由于文字的浮动小数点而失去精度和/或范围.
您可以在此处 [
The only two data types that can support values like this are Single and Double, though you''ll lose precision and/or range due to a, literal, floating decimal point.
You can read up on how the type works to support such values here[^].
这篇关于数值太大,无法容纳96位小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文