TBatchMove使用方法有点烦琐,自己看帮助文档吧。我这里有个现成的例子。
不要完全照抄,条件不同很可能会有错。
procedure TMainF.UPS(Str:String;da:Double);
var
temp:String;
begin
with QuUP do//QuUP是源表
begin
SQL.Clear;
temp:=format('select * from %s where DWDM<>''000''',[Str]);
if da>0 then
temp:=temp+format(' and GXSJ>%f',[Date-da]);
SQL.Add(temp);//这是查询产生源表
open;
end;
TaUP.TableName:=Str;//TaUP是目标表
BatchMove1.Mode:=batAppendUpdate;
BatchMove1.Source:=QuUP;
BatchMove1.Destination:=TaUP
BatchMove1.Execute;
QuUP.Close;
end;