不支持 ITransactionLocal 接口
我有一个 .NET 3.5 C# 库,它使用 OleDb 从 Excel 文件中提取数据并将其返回到 DataRowCollection 中,该数据由 SQL Server 2005 中的 CLR 表值函数使用。
当我在其上使用 SELECT 时,该函数工作正常。 但是,如果我想使用其输出作为 INSERT INTO 表的源,则会收到以下错误:
System.InvalidOperationException:“Microsoft.Jet.OLEDB.4.0”提供程序不支持 ITransactionLocal 接口。 当前提供商无法进行本地交易。 系统.InvalidOperationException: 在System.Data.OleDb.OleDbConnectionInternal.EnlistTransactionInternal(事务事务,布尔强制自动) 在 System.Data.OleDb.OleDbConnection.Open() 在 GetExcelFunction.GetFile(String strFileName) 在 GetExcelFunction.InitMethod(String strFileName)
那么,我该如何解决这个问题? 我是否要阻止连接创建事务? 如果是这样怎么办? 我在 OleDbConnection 上没有看到任何相关方法或属性。 连接字符串中有参数吗?
I have a .NET 3.5 C# library that uses OleDb to pull data from an Excel file and return it in a DataRowCollection which is used by a CLR Table-Valued Function in SQL Server 2005.
The function works fine when I use SELECT on it. But if I want to use its output as a source for an INSERT INTO a table, I get the following error:
System.InvalidOperationException: The ITransactionLocal interface is not supported by the 'Microsoft.Jet.OLEDB.4.0' provider. Local transactions are unavailable with the current provider.
System.InvalidOperationException:
at System.Data.OleDb.OleDbConnectionInternal.EnlistTransactionInternal(Transaction transaction, Boolean forcedAutomatic)
at System.Data.OleDb.OleDbConnection.Open()
at GetExcelFunction.GetFile(String strFileName)
at GetExcelFunction.InitMethod(String strFileName)
So, how do I solve this? Do I stop the connection from creating the transaction? If so how? I don't see any relevant methods or properties on the OleDbConnection. Is there a parameter in the connection string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将“;OLE DB Services=-4”添加到连接字符串。
add ";OLE DB Services=-4" to connection string.