gpt4 book ai didi

.NET 代码向存储在 Oracle DB 中的具有 1 或 3 个小数位的数字添加尾随 0

转载 作者:行者123 更新时间:2023-12-02 09:14:33 28 4
gpt4 key购买 nike

我在 .NET(使用 OracleDataAdapter)和 SQL Developer 中运行一个 SELECT 查询。结果集略有不同:

SQL Developer 返回:

enter image description here

.NET 返回:

enter image description here

如您所见,在点后有 1 位或 3 位数字的值的末尾有一个额外的 0。这个问题的根本原因是什么以及如何预防?

我们可以轻松删除代码中多余的 0,但我们希望通过修复潜在问题来防止它发生。谢谢!

更新(1/29/2018):

Oracle 中的数据类型: enter image description here

这是获取数据的 .NET 代码:

OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["conString"].ConnectionString);

if (conn.State != ConnectionState.Open)
conn.Open();

DataSet hereDataSet = new DataSet();

try
{
using (OracleCommand oCmd = new OracleCommand())
{
oCmd.Connection = conn;
oCmd.CommandText = "select V_COLUMN from T_TABLE where V_COLUMN='123'";

OracleDataAdapter oDataAdapter = new OracleDataAdapter(oCmd);

oDataAdapter.SelectCommand = oCmd;
oDataAdapter.Fill(hereDataSet);
}
}
catch (Exception ex)
{
// exception logic
}
finally
{
if (conn.State == ConnectionState.Open)
{ conn.Close(); }
}

最佳答案

我创建了 Oracle 的支持票。他们告诉我这是一个BUG

关于.NET 代码向存储在 Oracle DB 中的具有 1 或 3 个小数位的数字添加尾随 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48465285/

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