使用从COM +返回的ADODB记录集 [英] Using an ADODB recordset returned from COM+

查看:60
本文介绍了使用从COM +返回的ADODB记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows-> components中注册的DLL中有COM +组件.
DLL是用VB开发的,并使用Visual Studio 6进行编译.

我可以在组件中调用函数,以传递参数并从我的C ++程序中的函数接收值,而不会出现问题.
这些功能可以连接到远程数据库服务器,并且可以毫无问题地检索数据.

有一些函数返回一个记录集,这就是给我带来问题的原因.
包装函数的定义如下:
Adodb_tlb :: _ Recordset * __fastcall CheckActiveUser(long UserID/* [in] */);

我在程序中找不到访问此记录集的方法.
如果我尝试将以下类型的变量分配给此函数的结果,请执行以下操作:Adodb_tlb :: _ Recordset * 我收到错误消息:

GetDefaultInterface()-> CheckActiveUser(lngC_ID,(Adodb_tlb :: _ Recordset **)&Param3)'':
无法加入交易. @ CompSources \\ UBCore_OCX.cpp/1075"


我的开发环境是:"CodeGear C ++Builder®2007"

如果有人可以照亮我,我将永远感激不已.

Thomas

I have COM+ components in a DLL registred in Windows->components.
The DLL is developed in VB and compiled using Visual Studio 6.

I can call functions in the component passing parameters and receiving values from the functions in my C++ program without problems.
The functions connects to remote DB servers and retrieves data without problem.

There are functions that returns a recordset and this is what gives me the problem.

The wrapper function is defined thus:
Adodb_tlb::_Recordset* __fastcall CheckActiveUser(long UserID/*[in]*/);

I cannot find a way of accessing this recordset in my program.
If I try to assign a variable of type: Adodb_tlb::_Recordset* to the result of this function
I get the error:

GetDefaultInterface()->CheckActiveUser(lngC_ID, (Adodb_tlb::_Recordset**)&Param3)'':
Unable to enlist in the transaction. @ CompSources\\UBCore_OCX.cpp/1075"


My development environment is: "CodeGear C++Builder® 2007"

If anyone can shine a light on this I would be eternally grateful.

Thomas

推荐答案

您的错误消息显示无法参与交易":这是提示.许多年前(在NT4中)现在称为COM +的现在称为MTS,是Microsoft Transaction Server的缩写,其声明的目的是支持不同产品之间的分布式事务.

显然,您的COM +组件配置为事务上下文/必需".
如果是这样,并且您可以访问VB6源(或编写它的人),请查看是否可以将其更改为事务上下文/受支持";否则,您应该在使用com +组件之前在C ++代码中创建事务上下文.
另请参见:
COM +接口 [ ITransactionContext接口 [ ^ ].

如果您的COM +组件未配置事务上下文/必需",我的猜测是错误的.

希望对您有所帮助,
Your error message says "Unable to enlist in the transaction": this is the hint. Many years ago (in NT4) what''s now called COM+ was called MTS, short for Microsoft Transaction Server, and its declared purpose was to support distributed transactions among different products.

Apparently, your COM+ component is configured with "transaction context/required".
If this is true, and you have access to the VB6 source (or to the person who wrote it), see whether you can change this to "transaction context/supported"; otherwise, you should create a transaction context in your C++ code before using the com+ component.
See also:
COM+ Interfaces [^] with emphasis on ITransactionContext interface[^].

If your COM+ component is not configured with "transaction context/required", my guess is wrong.

Hope this helps,


这篇关于使用从COM +返回的ADODB记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆