ado in com+ with MTS(有此类应用开发经验的请进)

jett 2002-02-07 11:48:47
假设我做了一个activex dll
我不清楚当我在activex中调用objectcontext.setabout回滚时(或setcomplete),activex中的ado对象会不会跟着自动回滚(或提交),而不用调用connection对象的begintrans,和rollback trans方法(commit trans)
...全文
25 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
jett 2002-03-04
  • 打赏
  • 举报
回复

老贴子居然被翻了出来
结了~~~
ferrytang 2002-03-04
  • 打赏
  • 举报
回复
可以不用,objectcontext可以实现。
一般情况下没有必要同时用两个。
xhfjy 2002-03-04
  • 打赏
  • 举报
回复
呵,深刻关注
jett 2002-02-20
  • 打赏
  • 举报
回复
上面的那段英文资料好像意思是说不用
真的不写的话不会有什么问题的吧
jjjwltcs 2002-02-19
  • 打赏
  • 举报
回复
他不在家~,上班去了!
jett 2002-02-08
  • 打赏
  • 举报
回复
up
jett 2002-02-08
  • 打赏
  • 举报
回复
你为什么那么肯定,不行?
你老公是不是很擅长这个,让他来帮帮我的忙呀
jett 2002-02-08
  • 打赏
  • 举报
回复
回复人: jjjwltcs(树上的叶子) ( ) 信誉:94 2002-2-8 21:30:55 得分:0

不能!!!会当掉!你试试看!

是吗?
我刚从微软网站上看的资料
4.5 When does Microsoft Transaction Server automatically commit or abort a transaction?
Microsoft Transaction Server commits or aborts the transaction when the component that triggered creation of the transaction completes its work. The component signals that its work is complete by calling either SetComplete or SetAbort. SetComplete causes the transaction to commit; SetAbort causes the transaction to abort.

Microsoft Transaction Server will also commit or abort the transaction if the client releases its last reference to the component.

The following rules summarize when a transaction is committed or aborted.

· If the component calls SetComplete, the transaction commits as soon as the method call returns to the client, even if the client maintains a reference to the component.

· If the component calls SetAbort, the transaction aborts as soon as the method call returns to the client, even if the client maintains a reference to the component.

· If the component calls DisableCommit, the transaction aborts when the client releases its last reference to the component.

· If the component calls EnableCommit, the transaction commits when the client releases its last reference to the component.

If the component never calls SetAbort, SetComplete, DisableCommit, or EnableCommit, then the transaction commits when the client releases its last reference to the MTS component.

4.7 Why does Microsoft Transaction Server support automatic transactions?
Automatic transactions make it much easier to develop reliable component-based applications.

When using Microsoft Transaction Server, the programmer writes very little code that manages transactions. MTS automatically begins a transaction on behalf of an application component based upon the components' transaction property. Application programmers use the data access methods they are familiar with including ADO, RDO, OLE DB, JDBC, and ODBC. The underlying resource dispensers, such as the ODBC Driver Manager, transparently enlist the resources they manage in the component’s transaction. When each component completes its work, it informs Microsoft Transaction Server whether it wishes to commit or abort the transaction. When the final component completes its work, Microsoft Transaction Server determines the outcome of the transaction. If all of the components that participated in the transaction signified that the transaction should commit, then Microsoft Transaction Server will commit the transaction. If any component signified that the transaction should abort, Microsoft Transaction Server aborts the entire transaction.

Automatic Transactions make it easy to compose applications from independently authored components. Each component is marked to indicate its transaction requirements. Microsoft Transaction Server automatically initiates transactions and propagates transactions from component to component to satisfy these requirements. If any component that is participating in the transaction cannot commit the transaction, Microsoft Transaction Server ensures that the entire transaction is aborted. This makes it possible to build an application from components while allowing each component to enforce its portion of the business rules.

4.11 Can SQL Server transactions be used with Microsoft Transaction Server transactions?
Components can call BEGIN TRANSACTION, COMMIT TRANSACTION, or ROLLBACK TRANSACTION inside a transactional MTS component, although this is not recommended.

Calls to BEGIN TRANSACTION are ignored, as are calls to COMMIT TRANSACTION.

Calls to ROLLBACK TRANSACTION will abort the component's transaction even if the component calls SetComplete.

Components must not call BEGIN DISTRIBUTED TRANSACTION, PREPARE TRANSACTION, or SAVE TRANSACTION inside a transactional MTS component.
jett 2002-02-08
  • 打赏
  • 举报
回复
up
jjjwltcs 2002-02-08
  • 打赏
  • 举报
回复
不能!!!会当掉!你试试看!
jett 2002-02-08
  • 打赏
  • 举报
回复
我希望有个确信的答案
pkui 2002-02-08
  • 打赏
  • 举报
回复
从COM+的所有范例来分析,应该是不需要加数据库系统的begintrans和rollback trans方法,最好的办法是您人为地在您的组件中做一个错误,看错误发生前所作的数据修改是否回滚!
gmc007 2002-02-08
  • 打赏
  • 举报
回复
没做过,关注!

7,764

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧