TTMSFNCGridDatabaseAdapter: refresh after LoadAllDataAndDisconnect

Hello,

Duo to the limited grid functionality of TTMSFNCGridDatabaseAdapter, I have to use LoadAllDataAndDisconnect.

However, from time to time I need to refresh the data in the grid.
I tried this but it doesn't work:

MyQuery.Close;
MyQuery.Open;

MyFncGrid.Columns.BeginUpdate;
MyFncGrid.Columns.Clear;

MyGridDatabaseAdapter.AutoCreateColumns := True;  
MyGridDatabaseAdapter.Active            := True; // the adapter is already connected with MyQuery

MyFncGrid.AutoSizeColumns;

MyGridDatabaseAdapter.LoadAllDataAndDisconnect;
MyFncGrid.Columns.EndUpdate;

After the code above, I can see in Debug that MyFncGrid.Columns.count=5, MyFncGrid.RowCount=10, however the grid is empty.

What should I do? Thank you!

Please remove BeginUpdate & EndUpdate. This is blocking all the dataset loading. Only use BeginUpdate & EndUpdate when you are applying changes to the grid after loading the data.

Hello Pieter,

I removed BeginUpdate & EndUpdate and the grid is still visually empty although (as I wrote before), I can see in Debug that MyFncGrid.Columns.count=5, MyFncGrid.RowCount=10.

Can anything else cause this? Thank you!

Hi,

LoadAllDataAndDisconnect will set the Active property of the dataset to False, if you need to reload the data, you also need to set the DataSet Active property to true again.