http://www.csdn.net/expert/topic/273/273997.shtm

解决方案 »

  1.   

    下面得代码是我在DBGridBlxx中选取多行后,获取每一行的值作参数
    传递给存储过程ADOStoredProcChange ,重要的一句代码为:
    GoToBookMark(Pointer(DBGridBlxx.SelectedRows.Items[I]))
    供参考,这是从我的项目程序中copy的,有问题和我联系
    [email protected] DBGridBlxx.SelectedRows.Count > 0 then
     Begin
      With DBGridBlxx.DataSource.DataSet do
      Begin
      For I := 0 to DBGridBlxx.SelectedRows.Count - 1 do
       begin   GoToBookMark(Pointer(DBGridBlxx.SelectedRows.Items[I]));   With ADOStoredProcChange do
        Begin
        Parameters.ParamByName('@Ls_bh').Value := Ls_bh;
        Parameters.ParamByName('@Ls_xmdm').Value :=
           DBGridBlxx.DataSource.DataSet.FieldByName('xmdm').AsString;
        Parameters.ParamByName('@Ls_Blbh').Value :=
           DBGridBlxx.DataSource.DataSet.FieldByName('Blbh').AsString;
        Parameters.ParamByName('@dt_date').Value :=
           DateTimePickerCbsj.DateTime;
        ExecProc;
        end;
       end;
      end;
    end;
      

  2.   

    for i := 0 to Dbgrid1.Selectedrows.count - 1 do
    begin
      Dataset.book := dbgrid1.selectedrows.items[i];
      // do your things
    end;