问题标签 [system.data.oracleclient]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
382 浏览

c# - Oracle Instant Client 不工作 C#

我在安装 oracle 即时客户端时遇到问题,即使我按照此处的说明操作它也无法工作http://www.oracle.com/technetwork/database/features/instant-client/index-100365.html

这是我的 PATH 变量http://prntscr.com/3yzql4,您可以看到 PATH 具有即时客户端所在目录的值。

但是,当我启动一个项目(使用流利的 nhibernate)时,我得到以下异常

在代码的这一行

我知道人们说 ODP.NET 更好,但这是针对大学项目的,我必须使用它。

0 投票
1 回答
999 浏览

c# - Replacing TableAdapters with Oracle.DataAccess.Client (ODP.NET)

I have a legacy DAL with like 100 TableAdapters (DataSet xsd) but because we got new servers with Oracle client 12c I had to made the switch to the Oracle.DataAccess.Client (ODP.NET) from the old deprecated System.Data.OracleClient.

The only problem I have now is that I always get an error: ORA-01008: Not all variables bound when calling the Table Adapters.

I read that I have to set BindByName to true in OracleCommand for each TableAdapter. But how can I do that when the only place where OracleCommand is used is in the designer of the TableAdapter itself?

Is there some way to do this without extending each TableAdapter, because I have like 100 of them.

0 投票
0 回答
260 浏览

c# - 如何在 OracleDataReader 中检查 System.FormatException

我正在使用 OracleDataReader 从我的 C# 代码中调用 oracle 存储过程。我的代码类似如下

有时对象 myReader[0] 和 (myReader[1] 显示异常“System.FormatException:未找到数字”

如果发生上述异常,我需要为变量 num1 和 num2 分配一个默认值。如何检查 myReader[0] 和 myReader[1] 是否具有有效值?

0 投票
2 回答
313 浏览

c# - OracleClient 说我的连接已关闭

我有以下非常简单的代码:

显然我已经更改了连接字符串,但是如果连接字符串错误,则conn.Open()调用失败,所以我知道连接字符串是正确的,至少就数据源、用户 ID 和密码而言。

然而,当它接到cmd.ExecuteReader()电话时,我收到一条InvalidOperationException消息,Invalid operation. The connection is closed.

我用 C# 做了很多 SQL Server 的东西,但这是我第一次使用 OracleClient。除了它已被弃用之外,看不到任何明显错误的东西,但我认为它仍然会起作用。我不是想写任何生产代码,我只是想做一个小的一次性测试。

0 投票
1 回答
4664 浏览

c# - 将记录表从 Oracle 函数返回到 C# 应用程序

我们有一个 oracle 包,它返回一个记录类型的表。定义是:

wherer_daily_array_rec是一个包含多个字段的记录。然后我们在包中有一个函数,定义如下:

这一切都有效。但是我想从我的 C# 应用程序中调用这个函数,我已经使用 2 个不同的 Oracle 客户端驱动程序(.NET OracleClient 和 Oracle 的 odp.net)尝试了大约一百种不同的变体,但我似乎找不到方法让它工作。

我不想记录我尝试过的所有不同方式,但我使用 odp.net 驱动程序的最新迭代是这样的:

我尝试过各种 SQL 语句,例如:

select * from Table(FEED_SCHEDULE_PKG.f_daily_array_table(ip_contract_code)); 或者 begin FEED_SCHEDULE_PKG.f_daily_array_table(ip_contract_code); end;

我试过ExecuteNonQuery返回参数。我试过ExecuteReader进入IDataReader. 我已经为返回值参数名称尝试了“returnvalue”。

我四处寻找并尝试了我能找到的一切。没有一个示例函数与我们的非常相似。就像我说的,我尝试了很多变化。我似乎无法找到正确的设置。

我真的很感激这方面的一些帮助。

0 投票
1 回答
81 浏览

assemblies - 添加了对项目的缺失引用,但仍然无法识别类型。为什么?

我正在尝试在 Web Api 2 项目中创建一个访问 oracle 数据库的简单代码示例。

由于OracleClientdll“默认”不可用(如果我理解正确,在创建新项目时,目标框架子集不是完整的框架 dll 集),我添加了对 System.Data.OracleClient 的引用。

对 dll 类型的引用,如OracleConnection,OracleCommand等都被 VS 识别,就像 intelisenseOracleClient在键入后显示的一样System.Data

但是,构建会引发错误说明

运行时版本( v4.0.30319 ) 和版本(4.0.0.0) 与 System.Data 完全相同在创建时自动加载。

怎么了 ?

0 投票
0 回答
567 浏览

c# - System.Data.OracleClient.OracleDataReader 中的 FetchSize 等效项

Oracle.DataAccess.Client.OracleDataReader我们有一个名为“ FetchSize ”的属性。“ System.Data.OracleClient.OracleDataReader ”中是否有任何具有相同功能的东西。任何人都可以建议。

0 投票
2 回答
1073 浏览

dependency-injection - Correct way to use DbConnection, DbTransaction with connection pooling, transactionScope and dependency injection?

I have a Oracle database and I'm using the Oracle.ManagedDataAccess.

In some cases I will need to do actions in a single transactions, but often not.

I'm not sure what the best way to handle DbConnection objects within a single TransactionScope.

I could inject a DbConnection into the repositories and then even use LifetimePerScope to ensure they all get the same DbConnection instance. But is that a smart move, is it ok to .Open() the connection once.

This would force me to always use a LifetimeScope, even if not using a Transaction, and open the connection outside the repository method.

Are TransactionScopes dependent on a single connection or can I open multiple connections (how does the connectionPool handle that while a transaction is open?) within the same transaction?

I'm a total outsider to DbConnections and all that so I might be totally misunderstanding the best way to use TransactionScope and DbConnections.

0 投票
1 回答
723 浏览

c# - 如何防止在读取 Oracle FLOAT(126) 小数点后多位到 ADO.NET DataTable 时溢出?

当数据库列包含 number like0.11212121212121356500008888888888874343468766时,它​​不能适合 DataRow 生成的 Decimal 类型列。这同样适用于 DataReader。使用 DataReader 我已经用包装器解决了这个问题:

但是我怎样才能对 DataSet、DbDataAdapter 做些什么呢?用 ROUND 或 TRUNC 重写所有 datadapter-Select 命令不仅是错误的,而且是毫无疑问的,因为已经有数百个地方可以更改它。

注意这也适用于 ODP.NET。那里的类​​型是 OracleDecimal 而不是 OracleNumber。我的包装器用于两个客户端。

0 投票
1 回答
678 浏览

oracle9i - 在 IIS 上上传时出现错误“System.Data.OracleClient 需要 Oracle 客户端软件版本 8.1.7 或更高版本”

我正在使用带有 oracle 9i 数据库的 ASP.Net,当我尝试在 iis 服务器上上传项目时,它给了我类似“System.Data.OracleClient 需要 Oracle 客户端软件版本 8.1.7 或更高版本”的错误,是否需要安装客户端软件或任何其他解决方案?提前致谢..