Microsoft ODBC For Oracle 与 TransactionScope

发布于 2024-11-19 11:46:32 字数 952 浏览 3 评论 0原文

我使用Microsoft ODBC For Oracle,并使用TransactionScope处理分布式事务,但是,代码抛出错误:错误[HYC00][ORACLE][ODBC]选项未实现,我的代码在vb.net中。

这是我的代码:

sub Main()
    dim strConn1 as string = "Driver={Microsoft ODBC for Oracle};Server=server1;UID=user1;PWD=pwd1;"
    dim strConn2 as string = "Driver={Microsoft ODBC for Oracle};Server=server2;UID=user2;PWD=pwd2;"
    try
        using scope as new TransactionScope()
            using conn1 as new OdbcConnection(strConn1)
                conn1.Open()    'always throws error here
                dim command1 as new OdbcCommand(strSQL1)
                command1.ExecuteNonQuery()
                using conn2 as new OdbcConnection(strConn2)
                    dim command2 as new OdbcCommand(strSQL2)
                    command2.ExecuteNonQuery()
                end using
            end using
            scope.Complete()
        end using
    catch
    end try
end sub

谁能告诉我为什么,谢谢。

I use Microsoft ODBC For Oracle, and process a distributed transaction with TransactionScope, but, the code throws a error: ERROR [HYC00][ORACLE][ODBC]option not implement, my code is in vb.net.

Here is my code:

sub Main()
    dim strConn1 as string = "Driver={Microsoft ODBC for Oracle};Server=server1;UID=user1;PWD=pwd1;"
    dim strConn2 as string = "Driver={Microsoft ODBC for Oracle};Server=server2;UID=user2;PWD=pwd2;"
    try
        using scope as new TransactionScope()
            using conn1 as new OdbcConnection(strConn1)
                conn1.Open()    'always throws error here
                dim command1 as new OdbcCommand(strSQL1)
                command1.ExecuteNonQuery()
                using conn2 as new OdbcConnection(strConn2)
                    dim command2 as new OdbcCommand(strSQL2)
                    command2.ExecuteNonQuery()
                end using
            end using
            scope.Complete()
        end using
    catch
    end try
end sub

who can tell me why, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北方的巷 2024-11-26 11:46:32

这可能不是你的问题,但我从不使用 Microsoft Oracle 驱动程序。我总是使用 Oracle 驱动程序,也称为 Oracle Instant Client。您可以在此处获取

This may not be your problem, but I never use the Microsoft Oracle driver. I always use the Oracle driver, also known as the Oracle Instant Client. You can get it here.

溺渁∝ 2024-11-26 11:46:32

请说得更具体一些。就像连接对象在哪里一样。请放置整个类文件代码。连接对象似乎有些问题。粘贴完整代码,以便我们为您提供准确的解决方案

Please be more specific. Like where is connection object. Please put the entire class file code. It seems some problem with connection object. Paste the entire code so that we can provide you exact solution

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文