D
drinven
Unregistered / Unconfirmed
GUEST, unregistred user!
我用c++ builder实现以下代码时﹐发现第一条sql语句执行正确﹐
而第二条sql语句由于主键重复所以执行错误﹐本来结果应该是有错误提示﹐但
实际上却无错误提示﹐更不要说rollback了﹐致使把现有数据delete了﹐却无insert记录﹐
害得我可惨了﹐高手们﹐这是何原因啊?
strSQL="delete supply_qty where trader_id='0005' and supp_no=15;
insert into supply_qty(trader_id,supp_no,item,col_id,siz_id,supp_qty)
select '0005',15, item,col_id,siz_id,sum(supp_qty) supp_qty
from ##suppdet group by trader_id,supp_no,item,col_id,siz_id ;"
try
ADOConnection1->begin
Trans;
ADOConnection1->Execute(strSQL);
ADOConnection1->CommitTrans;
catch (Exception &E)
{
ADOConnection1->RollbackTrans() ;
Application->MessageBox(("执行SQL语句错误,错误信息﹕"+E.Message).c_str(),"JMSYS",MB_OK);}
}
而第二条sql语句由于主键重复所以执行错误﹐本来结果应该是有错误提示﹐但
实际上却无错误提示﹐更不要说rollback了﹐致使把现有数据delete了﹐却无insert记录﹐
害得我可惨了﹐高手们﹐这是何原因啊?
strSQL="delete supply_qty where trader_id='0005' and supp_no=15;
insert into supply_qty(trader_id,supp_no,item,col_id,siz_id,supp_qty)
select '0005',15, item,col_id,siz_id,sum(supp_qty) supp_qty
from ##suppdet group by trader_id,supp_no,item,col_id,siz_id ;"
try
ADOConnection1->begin
Trans;
ADOConnection1->Execute(strSQL);
ADOConnection1->CommitTrans;
catch (Exception &E)
{
ADOConnection1->RollbackTrans() ;
Application->MessageBox(("执行SQL语句错误,错误信息﹕"+E.Message).c_str(),"JMSYS",MB_OK);}
}