[Solved] How to remove SQLQuery.IndexDefs lazarus / 16-Databases ---------------------------------------------------------------------- Hansvb · 2021-08-22 21:17 Hi, With the help of this: Quote//https://wiki.lazarus.freepascal.org/Grid s_Reference_Page#Sorting_columns_or_rows_in_DBGrid_with_sort_arrows_in _column_header I can sort a dbgrid (Dataset). Now, when i Sort a dbgrid by clicking on a header (ROLE_NAME) and after that i want to load the data again i get the error: QuoteSQLQuery : Index 'ASC_ROLE_NAME' not found. I think i have to remove the Query indexes befor laoding the data again. How can that be done? I tried: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure Tfrm_maintain_users.MenuItemGetUsersClick(Sender: TObject);var  i : Integer;begin      DataModuleSQlite.SQLQuery.Close;      DataModuleSQlite.SQLite3Conn.Close();       DataModuleSQlite.SQLQuery.IndexDefs.Updated:=false;      DataModuleSQlite.SQLQuery.ClearIndexes; // Still get the error      DataModuleSQlite.SQLQuery.IndexDefs.Clear; // Still get the error     for I:= 0 to  DataModuleSQlite.SQLQuery.IndexDefs.Count-1 do        begin          DataModuleSQlite.SQLQuery.IndexDefs.Delete(i);  // Still get the error        end;       DataModuleSQlite.SQLQuery.IndexDefs.Update; ---------------------------------------------------------------------- Hansvb · 2021-08-23 09:13 Solved by using a zeos query. Then you can sort on sortype.