★
★蓝天★
Unregistered / Unconfirmed
GUEST, unregistred user!
datam1.ADOConnection1.BeginTrans ;
try
datam10.TB_purbody.UpdateBatch ;
datam10.Qry_Temp2.Close;
datam10.Qry_Temp2.SQL.Clear ;
datam10.Qry_Temp2.SQL.Add('UPDATE PURCHASEBODY SET PCB_NOCHKNUM=CASE');
datam10.Qry_Temp2.SQL.Add('WHEN (SELECT BK_QUNUM FROM BILLKIND WHERE BK_CODE=:BK1) IS NOT NULL THEN ROUND(PCB_NOCHKNUM,(SELECT BK_QUNUM FROM BILLKIND WHERE BK_CODE=:BK2))');
datam10.Qry_Temp2.SQL.Add('ELSE ROUND(PCB_NOCHKNUM,0) END');
datam10.Qry_Temp2.SQL.Add('WHERE PCB_PCHBILL=:BILL');
datam10.Qry_Temp2.SQL.Add('AND PCB_PCHKIND=:KIND');
datam10.Qry_Temp2.SQL.Add('AND PCB_SORT=:SORT');
datam10.Qry_Temp2.Parameters.ParamByName('BK1').Value :=DBEdit1.Text ;
datam10.Qry_Temp2.Parameters.ParamByName('BK2').Value :=DBEdit1.Text ;
datam10.Qry_Temp2.Parameters.ParamByName('BILL').value:=datam10.TB_acception.FieldByName('ACB_PURCHASE').AsString ;
datam10.Qry_Temp2.Parameters.ParamByName('KIND').value:=datam10.TB_acception.FieldByName('ACB_PURKIND').AsString ;
datam10.Qry_Temp2.Parameters.ParamByName('SORT').value:=datam10.TB_acception.FieldByName('ACB_PURBSORT').AsString ;
datam10.Qry_Temp2.ExecSQL ;
datam1.ADOConnection1.CommitTrans ;
except
datam1.ADOConnection1.RollbackTrans ;
raise;
end;
当我把事务取消后,程序能很正常地运行,但是当我把事务加上去后,TB_purbody这个表里所保存
的几个几个字段的值却没有保存进去.
我试着把事务加上,再把有datam10.Qry_Temp2的那些代码去掉,数值还是进入了数据库里,
我想datam10.TB_purbody.UpdateBatch应该没问题.请高手指教,急!!!
try
datam10.TB_purbody.UpdateBatch ;
datam10.Qry_Temp2.Close;
datam10.Qry_Temp2.SQL.Clear ;
datam10.Qry_Temp2.SQL.Add('UPDATE PURCHASEBODY SET PCB_NOCHKNUM=CASE');
datam10.Qry_Temp2.SQL.Add('WHEN (SELECT BK_QUNUM FROM BILLKIND WHERE BK_CODE=:BK1) IS NOT NULL THEN ROUND(PCB_NOCHKNUM,(SELECT BK_QUNUM FROM BILLKIND WHERE BK_CODE=:BK2))');
datam10.Qry_Temp2.SQL.Add('ELSE ROUND(PCB_NOCHKNUM,0) END');
datam10.Qry_Temp2.SQL.Add('WHERE PCB_PCHBILL=:BILL');
datam10.Qry_Temp2.SQL.Add('AND PCB_PCHKIND=:KIND');
datam10.Qry_Temp2.SQL.Add('AND PCB_SORT=:SORT');
datam10.Qry_Temp2.Parameters.ParamByName('BK1').Value :=DBEdit1.Text ;
datam10.Qry_Temp2.Parameters.ParamByName('BK2').Value :=DBEdit1.Text ;
datam10.Qry_Temp2.Parameters.ParamByName('BILL').value:=datam10.TB_acception.FieldByName('ACB_PURCHASE').AsString ;
datam10.Qry_Temp2.Parameters.ParamByName('KIND').value:=datam10.TB_acception.FieldByName('ACB_PURKIND').AsString ;
datam10.Qry_Temp2.Parameters.ParamByName('SORT').value:=datam10.TB_acception.FieldByName('ACB_PURBSORT').AsString ;
datam10.Qry_Temp2.ExecSQL ;
datam1.ADOConnection1.CommitTrans ;
except
datam1.ADOConnection1.RollbackTrans ;
raise;
end;
当我把事务取消后,程序能很正常地运行,但是当我把事务加上去后,TB_purbody这个表里所保存
的几个几个字段的值却没有保存进去.
我试着把事务加上,再把有datam10.Qry_Temp2的那些代码去掉,数值还是进入了数据库里,
我想datam10.TB_purbody.UpdateBatch应该没问题.请高手指教,急!!!