方法一:直接操控SQL语句,insert into new_table(col1,col2..) select ....searchcondition
方法二:操作BOOKMARK
var
i:integer;
x: word;
TempBookmark: TBookMark;
begin
i:=0;
DBGrid1.Datasource.Dataset.DisableControls;
while i<=dbgrid1.SelectedRows.Count-1 do
begin
DBGrid1.Datasource.Dataset.Bookmark:= dbgrid1.SelectedRows.Items;
TempBookmark:= DBGrid1.Datasource.Dataset.GetBookmark;
DBGrid1.Datasource.Dataset.GotoBookmark(TempBookmark);
// 现在DBGRID1连接的数据集指到了一条选择的记录,可以进行操作了
// 比如 DbGrid1.DataSource.DataSet.FieldByName('record1').AsString...
end;
DBGrid1.Datasource.Dataset.FreeBookmark(TempBookmark); //释放临时BOOKMARK
DBGrid1.Datasource.Dataset.EnableControls;
End;