Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I refresh a TDBGrid?

I have a TDBGrid called myDbGrid that I want to update after a change to the database (insert/update/delete). How can I do this without reloading my form completely?

myDbGrid uses myDataSource and it uses myQry as its data set.

I've tried the following with no success:

myDbGrid.Refresh;

and

myDbGrid.DataSource.DataSet.Close;
myQry.Close; // '' I think this is redundant
myQry.Open;
myDbGrid.DataSource.DataSet.Refresh;

What have I missed?

(I'll note that the database change is not happening in the tDBGrid - it's there for display only)

like image 807
BIBD Avatar asked Feb 19 '15 16:02

BIBD


1 Answers

The only code that is needed here is:

myDbGrid.DataSource.DataSet.Refresh; 

Everything else is redundant in this particular case.

like image 174
BIBD Avatar answered Oct 20 '22 21:10

BIBD