Forum > Databases

[Solved] How to remove SQLQuery.IndexDefs

(1/1)

Hansvb:
Hi,

With the help of this:
--- Quote ---//https://wiki.lazarus.freepascal.org/Grids_Reference_Page#Sorting_columns_or_rows_in_DBGrid_with_sort_arrows_in_column_header
--- End quote ---
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:

--- Quote ---SQLQuery : Index 'ASC_ROLE_NAME' not found.
--- End quote ---

I think i have to remove the Query indexes befor laoding the data again. How can that be done?

I tried:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
Solved by using a zeos query. Then you can sort on sortype.

Navigation

[0] Message Index

Go to full version