有兩個表,要把其中一個表的數據根據客戶選 擇放入另一個表當中
用兩個DBGRID控件,一個是原表dbgrid1,另一個是目的表dbgrid2。
請問如何判斷
謝謝

解决方案 »

  1.   

    我設的DBGRID為可以多選。
    只要用戶選擇了就算,
      

  2.   

    用SelectedIndex
    procedure TForm1.LeftRightClick(Sender: TObject);
    begin
      DBGrid1.SelectedIndex := DBGrid1.SelectedIndex + TComponent(Sender).Tag;
      DBGrid1.SetFocus;
    end;
      

  3.   

    把dbgrid的options的dgindicator设为false,
    procedure TForm1.DBGrid1CellClick(Column: TColumn);
    begin
      showmessage(inttostr(form1.Table1.RecNo));//判断选择了哪一条记录
    end;
      

  4.   

    DBGrid.DataSource.Dataset.GotoBook(Pointer(DBGrid.SelectedRows.Items[0]));
    for j := 0 to DBGrid.SelectedRows.Count - 1 do
    begin
      .
      .
      .
      DBGrid.DataSource.Dataset.GotoBook(Pointer(DBGrid.SelectedRows.Items[J+1]));
    end
      

  5.   

    假如我有一個表當中有10條記錄,客戶要選擇9條記錄放入另一個表,
    而這10條記都顯示在DBGRID1當中,
    我的思路是
    table1.first;
    while not eof do  --不知對不對。
      begin
        if (是被選中的) then
          begin
            table2.append
            ......
          end;
      end;