Midas中企业逻辑对象中的事务问题(调用其它几个组件的方法)(100分)

  • 主题发起人 yuanjunjing
  • 开始时间
Y

yuanjunjing

Unregistered / Unconfirmed
GUEST, unregistred user!
用一个control comobject 调用其它二个comobject1/comobject2的方法.要求在一个事务中执行.
设定这三个对象的事务模式为需要事务模式.
在control comobject中写
try
//第一步
ComObject_share:=CoTDM_Share.CreateRemote(RomateServerName) ;
ComObject_share.GetNewNoteNo('RC','E','1',NewNoteNo);
//第二步
ComObject_RcIn:=CoTDM_RcIn.CreateRemote(RomateServerName) ;
ComObject_RcIn.InSave(Iden_List,User_Name,NewNoteNo);
setcomplete;
except
showmessage('run controlobject abort');//调试
Setabort;
end;

对象comobject1中写
try
adosp_main.Close;
adosp_main.Parameters.ParamByName('@Department').Value:=Department;
adosp_main.Parameters.ParamByName('@Note_Type').Value:=Note_Type;
adosp_main.Parameters.ParamByName('@Saved').Value:=Saved;
adosp_main.Prepared;
adosp_main.ExecProc;
NewNoteNo:=adosp_main.Parameters.ParamByName('@return_no').Value;
SetComplete;
except
setabort;
raise;
end;

对象comobject2中写
try
adocmd_main.CommandText:='update rcin '
+' set operator='+#39+User_Name+#39;
adocmd_main.Execute;
Setcomplete;
except
setabort;
raise;
end;

--------------------
问题出现,comobject2中方法失败时,调试得知control comobject执行setabort方法,但实际结果是comobject1方法中的数据已保存到数据库中,而comobject2中没有,请问会是什么原因引起的?
 
在选择 Transaction Model
1.Requires a transaction,
2.Requires a new transaction,.
3.Supports transactions ,
4.Does not support transactions
你选择那种类型
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
569
import
I
顶部