for i= num1 to num2 do
begin
FileName1='file'+IntToStr(num1);//num1为你输入的数1
...
query1.sql:= 'insert into totalfiles select * from '+FileName1
...
end;
begin
FileName1='file'+IntToStr(num1);//num1为你输入的数1
...
query1.sql:= 'insert into totalfiles select * from '+FileName1
...
end;
还是表名:::
如果是列名的话,楼上的方法可行
如果是表名的话,就用BatchMove控件来实现
table3:='file'+strtoint(trim(edit3.text));
batchmove.source:=table1;
batchmove.destination:=table2;
batchmove.mode:=batappendupdate;
batchmove.source:=table3;
batchmove.destination:=table2;
batchmove.mode:=batappendupdate;
try
batchmove.excute;
finally
batchmove.free;
table1.free;
table3.free;
end;
如果用SQL语句如下:
select table1.*,table3.* into table2 from table1,table3
但是TABLE2应该是步存在的.可以通过
rename table3 totalfiles
var
FileName1:String;
......
for i= num1 to num2 do
begin
FileName1='file'+IntToStr(i);//num1为你输入的数1
....
Query1.Close;
Query1.SQL.Text:=
'insert into totalfiles select * from '+FileName1;
Query1.ExecSQL;//每次循环把表的内容加到totalfiles里。
...
end;