C
chshanghai
Unregistered / Unconfirmed
GUEST, unregistred user!
麻烦费点时间看一下下面的程序. (sql 语句肯定没问题)
try
with table_data.ADO_Query do begin
//完工入库配件:写
sql.clear;
sql.add('insert into tb_wgrkmx(frkdjh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj) ');
sql.Add('select :v_rkdh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj from tb_pjjhmx ');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
execsql;
//完工入库单据:写
sql.Clear;
sql.add('insert into tb_wgrkdj(frkdjh,fydjh ,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq)');
sql.add('select :v_rkdh,fjhdh,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq from tb_pjjhdj ');
sql.add('where fjhdh=:v_jhdh');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
parameters.ParamByName('v_jhdh').value:=trim(dbedit1.Text);
execsql;
table_data.ado_yydw.CommitTrans ;
end;//with
except
table_data.ado_yydw.RollbackTrans ;
error('[配件入库] 并库不成功');
end; //try
为什么只能提交貌一新“ 完工入库单据 ” 而 " 完工入库配件 "不能提交
但不加事务后即: 下面的两个都能提交
with table_data.ADO_Query do begin
//完工入库配件:写
sql.clear;
sql.add('insert into tb_wgrkmx(frkdjh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj) ');
sql.Add('select :v_rkdh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj from tb_pjjhmx ');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
execsql;
//完工入库单据:写
sql.Clear;
sql.add('insert into tb_wgrkdj(frkdjh,fydjh ,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq)');
sql.add('select :v_rkdh,fjhdh,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq from tb_pjjhdj ');
sql.add('where fjhdh=:v_jhdh');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
parameters.ParamByName('v_jhdh').value:=trim(dbedit1.Text);
execsql;
table_data.ado_yydw.CommitTrans ;
end;//with
为什么样????? 我都快疯了 ....
try
with table_data.ADO_Query do begin
//完工入库配件:写
sql.clear;
sql.add('insert into tb_wgrkmx(frkdjh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj) ');
sql.Add('select :v_rkdh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj from tb_pjjhmx ');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
execsql;
//完工入库单据:写
sql.Clear;
sql.add('insert into tb_wgrkdj(frkdjh,fydjh ,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq)');
sql.add('select :v_rkdh,fjhdh,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq from tb_pjjhdj ');
sql.add('where fjhdh=:v_jhdh');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
parameters.ParamByName('v_jhdh').value:=trim(dbedit1.Text);
execsql;
table_data.ado_yydw.CommitTrans ;
end;//with
except
table_data.ado_yydw.RollbackTrans ;
error('[配件入库] 并库不成功');
end; //try
为什么只能提交貌一新“ 完工入库单据 ” 而 " 完工入库配件 "不能提交
但不加事务后即: 下面的两个都能提交
with table_data.ADO_Query do begin
//完工入库配件:写
sql.clear;
sql.add('insert into tb_wgrkmx(frkdjh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj) ');
sql.Add('select :v_rkdh,fckdm,fpjdm,fpjmc,fpydm,fjhsl,fdw,fsqdj,fshdj from tb_pjjhmx ');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
execsql;
//完工入库单据:写
sql.Clear;
sql.add('insert into tb_wgrkdj(frkdjh,fydjh ,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq)');
sql.add('select :v_rkdh,fjhdh,fcjdm,fcjmc,ffphm,fywy,fczy,fzje,fyfje,fsl,fjsfs,fbz,fjhrq from tb_pjjhdj ');
sql.add('where fjhdh=:v_jhdh');
parameters.ParamByName('v_rkdh').value:=trim(v_rkdjh);
parameters.ParamByName('v_jhdh').value:=trim(dbedit1.Text);
execsql;
table_data.ado_yydw.CommitTrans ;
end;//with
为什么样????? 我都快疯了 ....