Mega Code Archive

 
Categories / Delphi / Examples
 

Update controls bound to a query without a primary index

If a query has a primary index, you may just code "Query1.Refresh" to update a form. This fails if the query has no primary index. The following procedure shows a flicker-reduced solution: procedure UpdateQuery(aQuery : TQuery); var aBookmark : TBookmark; begin aQuery.DisableControls; aBookmark := aQuery.GetBookmark; aQuery.Close; aQuery.Open; aQuery.GotoBookmark (aBookmark); aQuery.FreeBookmark (aBookmark); aQuery.EnableControls; end;