if not QueryCopyDataFlag(sPicName) then //没拷贝
begin
for i:=1 to 3 do //3个表
begin
sSQL:='insert into tb_Data_'+inttostr(i)+'_5 select * from tb_Data_'+inttostr(i)+'_4'+
' where batchName='+Quotedstr(CurrBatchName)+' and PicName='+Quotedstr(sPicName);
if not ExecSQLString(sSQL) then
begin
TDBConnector.Instance.Connection.RollbackTrans;
Exit;
end;
end;
sSQL:='update TB_Picture set Status5=1, Begin5='+ QuotedStr(DateTimeToStr(sDate))+',User5='+
QuotedStr(TLoginUser.Instance.UserID)+' where BatchName='+QuotedStr(CurrBatchName)+'and PicName='+Quotedstr(sPicName);
if not ExecSQLString(sSQL) then
begin
TDBConnector.Instance.Connection.RollbackTrans;
Exit;
end;
end;
next
end;//end while
Close;
finally
Free;
end;
end;
begin
for i:=1 to 3 do //3个表
begin
sSQL:='insert into tb_Data_'+inttostr(i)+'_5 select * from tb_Data_'+inttostr(i)+'_4'+
' where batchName='+Quotedstr(CurrBatchName)+' and PicName='+Quotedstr(sPicName);
if not ExecSQLString(sSQL) then
begin
TDBConnector.Instance.Connection.RollbackTrans;
Exit;
end;
end;
sSQL:='update TB_Picture set Status5=1, Begin5='+ QuotedStr(DateTimeToStr(sDate))+',User5='+
QuotedStr(TLoginUser.Instance.UserID)+' where BatchName='+QuotedStr(CurrBatchName)+'and PicName='+Quotedstr(sPicName);
if not ExecSQLString(sSQL) then
begin
TDBConnector.Instance.Connection.RollbackTrans;
Exit;
end;
end;
next
end;//end while
Close;
finally
Free;
end;
end;
解决方案 »
- 怎么样使Stringgrid插入的新纪录永远初一第一行
- 在adoquery中怎么判断当前指针的位置是不是最后一条记录?
- 关于sql表格导出为txt
- dxDBGrid中的列如何与从数据库中查出的数据的列一一对应上?
- 请问怎样的到form的left和top改变了的事件??是什么事件啊.
- delphi问题。定义 maary :array[0..5] of string,如果myary[i]字符串长度>255怎么办?
- 进来没有分,给个人分帖,请不要进
- 一个关于比较日期大小的问题,急!!! 100分
- 好长时间上不来,分不少了,放点给大家。。。
- 可以在Delphi程序中设定输入的全角、半角和输入法的切换?
- 窗体如何保存为模板,别的MDI子窗体直接继承即可???
- 一个困惑好久的关于BPL包中窗体调用的问题
这有什么解释的如果 QueryCopyDataFlag(sPicName) 返回不为真 则执行下面的程序
if not QueryCopyDataFlag(sPicName) then //没拷贝
begin
for i:=1 to 3 do //3个表
begin
sSQL:='insert into tb_Data_'+inttostr(i)+'_5 select * from tb_Data_'+inttostr(i)+'_4'+
' where batchName='+Quotedstr(CurrBatchName)+' and PicName='+Quotedstr(sPicName); //插入数据
if not ExecSQLString(sSQL) then //如果执行失败
begin
TDBConnector.Instance.Connection.RollbackTrans; //回滚事务
Exit;
end;
end;
sSQL:='update TB_Picture set Status5=1, Begin5='+ QuotedStr(DateTimeToStr(sDate))+',User5='+
QuotedStr(TLoginUser.Instance.UserID)+' where BatchName='+QuotedStr(CurrBatchName)+'and PicName='+Quotedstr(sPicName); //更新TB_Picture
if not ExecSQLString(sSQL) then //如果执行不成功
begin
TDBConnector.Instance.Connection.RollbackTrans; //回滚事务
Exit;
end;
end;
next
end;//end while
Close;
finally
Free;
end;
end;
Exit;
end;
end;
sSQL:='update TB_Picture set Status5=1, Begin5='+ QuotedStr(DateTimeToStr(sDate)) +',User5='+
QuotedStr(TLoginUser.Instance.UserID)+' where BatchName='+QuotedStr(CurrBatchName)+'and PicName='+Quotedstr(sPicName); //更新TB_Picture
if not ExecSQLString(sSQL) then //如果执行不成功
begin
TDBConnector.Instance.Connection.RollbackTrans; //回滚事务
Exit; 那怎么在回滚事物中还有个sql语句是干吗的
QuotedStr(TLoginUser.Instance.UserID)+' where BatchName='+QuotedStr(CurrBatchName)+'and PicName='+Quotedstr(sPicName); //更新TB_Picture
应该是更改状态的;第一个回滚只是 针对上一个SQL语句的处理,即'insert into tb_Data_'+inttostr(i)+'_5 select * from tb_Data_'+inttostr(i)+'_4'+
' where batchName='+Quotedstr(CurrBatchName)+' and PicName='+Quotedstr(sPicName); 它与后边的无关