展开全部
用table比较麻烦
adotable1关联表test 源表
adotable2关联test2 想插入数据的目的表
procedure TForm1.Button1Click(Sender: TObject);
begin
adotable1.First;
while not adotable1.Eof do
begin
adotable2.Append;
adotable2.FieldByName('name').Value:=adotable1.fieldbyname('name').AsString;
adotable1.Next;
end;
adotable2.Post;
end;
建议用QUERY来操作比较简单,一条SQL语句即可完成
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into test2(name) select name from test');
adoquery1.ExecSQL;
end;
adotable1关联表test 源表
adotable2关联test2 想插入数据的目的表
procedure TForm1.Button1Click(Sender: TObject);
begin
adotable1.First;
while not adotable1.Eof do
begin
adotable2.Append;
adotable2.FieldByName('name').Value:=adotable1.fieldbyname('name').AsString;
adotable1.Next;
end;
adotable2.Post;
end;
建议用QUERY来操作比较简单,一条SQL语句即可完成
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into test2(name) select name from test');
adoquery1.ExecSQL;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询