How to update TDBGrid?

I have a TDBGrid with the name myDbGridthat I want to update after changing the database (insert / update / delete). How can I do this without completely reloading my form?

myDbGriduses myDataSourceand uses myQryas its dataset.

I tried the following without success:

myDbGrid.Refresh;

and

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

What did I miss?

(I will notice that the database change does not occur in tDBGrid - it is only for display)

+4
source share
1 answer

Only the following code is needed here:

myDbGrid.DataSource.DataSet.Refresh; 

In this particular case, everything else is redundant.

+5
source

All Articles