我已设置了dbgrid的多重选择,但如何把已选择的多条记录转存入另一临时表。

解决方案 »

  1.   

    下面是delphi的帮助,相信对你很有帮助.
    The following example copies the selected rows in a db grid to a list box.procedure TForm1.Button1Click(Sender: TObject);
    var
      i, j: Integer;
      s: string;
    begin
      if DBGrid1.SelectedRows.Count>0 then
        with DBGrid1.DataSource.DataSet do
          for i:=0 to DBGrid1.SelectedRows.Count-1 do
          begin
            GotoBook(pointer(DBGrid1.SelectedRows.Items[i]));
            for j := 0 to FieldCount-1 do
            begin          if (j>0) then s:=s+', ';
              s:=s+Fields[j].AsString;
            end;
            Listbox1.Items.Add(s);
            s:= '';
          end;
    end;
      

  2.   

    来玩了,楼上的十分正确,在Delphi的帮助里面也有