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中没有,请问会是什么原因引起的?
设定这三个对象的事务模式为需要事务模式.
在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中没有,请问会是什么原因引起的?