How to enhance TDBGrid performance in a slow ODBC connection (Views: 101)


I am using a TDBGrid through a slow ODBC connection to the data. When I scroll the grid it changes the selected row and takes an age to update all the "detail" queries run off it. The time it takes to update the "detail" queries wouldn't be a problem if I could scroll the grid and then select a new row once the one I want was in view. Any ideas?


Don't use automatic linking, because it re-executes detail queries on every datachange. Instead, use manual linking with timer:

procedure Datasource1Datachange(...)
  Timer1.Enabled := false;
  Timer1.Enabled := true;

procedure Timer1Timer(..);
  {details will be refreshed only when timer expires}
  DetailQ.Params[0].AsInteger := MasterQLinkField.AsInteger;

I use timer interval from 300 - 500 ms. With this small trick you'll see a real performance boost.

<< Back to main page