Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UpdateDBGrid

Status
Not open for further replies.

dmarnerou

Programmer
Jun 12, 2002
30
CY
I would like to ask how to update a DBGrid while my application is running.
For example if i change the data on that dbgrid it does not show the changes immediately but only after i run the program again. I want the DBGrid to update at runtime.

Anyone knows how I can do this?

Thanks,
Demetra
 
Unless DataSet.DisableControls, any change to the database should appear in the grid immediately.

If another user changes the data, then you need to Table.Refresh to see them.

Are these the changes you are talking about?

Cheers
 
For example I have a DBGrid which shows some records and a button which deletes a selected record.
i want to implement another button, the Refresh button, which will show me the updated DBGrid.

Source code would be really helpful

Thanks,
Demetra
 
Code:
procedure TForm1.DeleteButtonClick(...);
begin
   DBGrid1.DataSource.DataSet.Delete;
end;

procedure TForm1.RefreshButtonClick(...);
begin
   with DBGrid1.DataSource.DataSet do
   begin
       if State dsBrowse then
            Refresh;
   end;
end;

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top