各位兄弟: 我有两个表a,b,a和b在两个数据库中(用两个connectionA,B).现在B.execute(insert into b select from a)和A.excute( delete from a)用A和B.begintrans()都提示"cant create new connection in manual or distributed transaction mode",不知道啥原因啊....
现在我用conserver->begintrans().conclient->begintrans()时报错"cant create new connection in manual or distributed transaction mode",不知是哪里设置不正确。 对与这种嵌套事务大家用过没有。
然后你还要insert into b select from a??这样好像是不行的吧
要导数据才行
我用两个连接A和B分别连数据库a,b(在两台机器上)。
从A中取出每一行insert 到B.b中去,then delete掉A.a中的该行。怎样实现事务。
实际上,也可以用server端控制,但现在的要求是必须有客户端定时的将数据从一个服务器的库倒想另一个服务器的数据库对应的表中。用Ado时就是不能用transaction,单个的执行都能满足要求,但没有事务怎门行呢?vc也用了一段时间了,sql server几年前用PB时也摆弄过较长时间,却连这个不是问题的问题却解决不了,你说多郁闷。
这样直接在A上启动事务就行了吧?还不好使么?
对与这种嵌套事务大家用过没有。
还是这样:
BOOL bsucess = FALSE;
try{
con`1->execute("insert")
bsucess = TRUE;
}
catch (_com_error e)
{
bsucess = FALSE
}
if ( bsucess)
{
con2.exeucte("delete");
}
还是结贴了