TDBGRIDS

Please discuss general Delphi programming topics here.

TDBGRIDS

Postby werdnareid » August 8th, 2003, 9:20 pm

Is it possiable -- and if it is how would i retrive records from a TDBGRIDS.
werdnareid
Active Member
Active Member
 
Posts: 22
Joined: August 6th, 2003, 5:35 pm

Postby Kambiz » August 8th, 2003, 11:07 pm

What do you mean exactly? :?
DBGrid shows the records, not storing them.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

What i want to Achieve

Postby werdnareid » August 10th, 2003, 6:43 am

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.
[]
werdnareid
Active Member
Active Member
 
Posts: 22
Joined: August 6th, 2003, 5:35 pm

Postby Kambiz » August 10th, 2003, 11:52 am

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
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 18 guests

cron