数值太大,无法容纳96位小数

编程入门 行业动态 更新时间:2024-10-23 04:45:57
本文介绍了数值太大,无法容纳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位小数

本文发布于:2023-11-29 16:39:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646968.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:太大   小数   数值

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!