Page 1 of 1

TDBGRIDS

PostPosted: August 8th, 2003, 9:20 pm
by werdnareid
Is it possiable -- and if it is how would i retrive records from a TDBGRIDS.

PostPosted: August 8th, 2003, 11:07 pm
by Kambiz
What do you mean exactly? :?
DBGrid shows the records, not storing them.

What i want to Achieve

PostPosted: August 10th, 2003, 6:43 am
by werdnareid
I want to allow the user to select a number of records using the multipleselect option. and them be able to retrive only those selected records.
[]

PostPosted: August 10th, 2003, 11:52 am
by Kambiz
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  Bookmark: TBookmarkStr;
  I: Integer;
begin
  DBGrid1.DataSource.DataSet.DisableControls;
  Bookmark := DBGrid1.DataSource.DataSet.Bookmark;
  try
    for I := 0 to DBGrid1.SelectedRows.Count - 1 do
    begin
      DBGrid1.DataSource.DataSet.Bookmark := DBGrid1.SelectedRows[I];
      // Here the current record of the data set is one of the selected ones
    end;
  finally
    DBGrid1.DataSource.DataSet.Bookmark := Bookmark;
    DBGrid1.DataSource.DataSet.EnableControls;
  end;
end;


Hope that it helps.
Kambiz