【问题标题】:Error in Oracle while populating a Datatable - C# .NET填充数据表时 Oracle 出错 - C# .NET
【发布时间】:2017-07-25 08:10:42
【问题描述】:

当我尝试通过 .NET 填充 Oracle 表的 datatable 时,出现错误

这是我使用的代码:

DataTable PRDTableResults = new DataTable();
using (OracleDataAdapter dataAdapter = new OracleDataAdapter())
{
  OracleCommand cmd = new OracleCommand("SELECT * from PRD");
  cmd.CommandType = CommandType.Text;
  cmd.Connection = conn;
  dataAdapter.SelectCommand = cmd;
  dataAdapter.Fill(PRDTableResults);
 }

我不确定为什么会出现这样的错误。 PRD 表的字段未定义精度和比例,但定义为 NUMBER

【问题讨论】:

    标签: c# .net oracle datatable


    【解决方案1】:

    我以前遇到过这个错误,我记得它是由 Oracle ODBC 驱动程序中的错误引起的。我不记得确切的版本,我认为它影响了 10.2 和 11.2 版本,并且仅在 x64 位驱动程序中。

    所以你可以试试这个,在你的应用项目的属性中将平台目标从 AnyCPU 设置为 X86。

    【讨论】:

    • 有趣!谢谢
    猜你喜欢
    • 1970-01-01
    • 2017-07-10
    • 2010-12-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-20
    • 1970-01-01
    • 1970-01-01
    • 2015-02-18
    相关资源
    最近更新 更多