DBGrid error lazarus / 31-LCL ---------------------------------------------------------------------- mmelwin · 2021-06-11 05:31 When I click on DBGrid while running a Locate on SQLQuery, the DBGrid crashes. Can I prevent this somehow? Disable / EnableControls doesn't help. I am attaching two screenshots, before and after Locate. ---------------------------------------------------------------------- Handoko · 2021-06-11 06:31 Only some screenshots does not help much. We need more information. Please provide more information to help us help you. Version of the software (OS, Lazarus, database, etc) and steps to reproduce the issue. It will be extremely helpful if you can provide the compile-able source code, so we can inspect and debug it on our computer. If you're not willing to publicize the project, you can write a short demo that can let us to reproduce the problem. You can use the Publish Project feature in the IDE: Lazarus main menu > Project > Publish project Or manually select and include the files: Create a new folder, copy and paste all the necessary files (including the data file) except: the binary (exe file), *.bak, lib and backup folders. Compress the folder and send the zip to the forum. ---------------------------------------------------------------------- mmelwin · 2021-06-11 06:41 Lazarus 2.0.12, FPC 3.2.0, OS Win10, PostgreSQL 13. I will prepare a demo. ---------------------------------------------------------------------- mmelwin · 2021-06-11 08:44 Please click "Populate", wait a while, click "Locate" and quickly click in the DBGrid area. The problem only occurs when the searched field is sorted descending. For ease of use, the demo uses SQLite. ---------------------------------------------------------------------- dseligo · 2021-06-11 10:20 I tried your example and I can confirm the problem. I then tried with ZeosDBO components and it works, but maybe because it locates row before I have a chance to click DBGrid. Test project with ZeosDBO components is attached if you want to try it. ---------------------------------------------------------------------- Handoko · 2021-06-11 10:30 I tested DEMO.7Z on Ubuntu Mate 20.10 using Lazarus 2.0.10 64-bit, could not reproduce the problem. ---------------------------------------------------------------------- mmelwin · 2021-06-11 12:28 Quote from: dseligo on June 11, 2021, 12:20:59 pmI tried your example and I can confirm the problem. I then tried with ZeosDBO components and it works, but maybe because it locates row before I have a chance to click DBGrid. Test project with ZeosDBO components is attached if you want to try it. Didn't you have a chance to click on DBGrid. Locate in Zeos is very fast because it loads the entire query result at once. SQLdb only loads the first few lines. ---------------------------------------------------------------------- mmelwin · 2021-06-18 05:41 I still don't know how to prevent it. I don't want to switch to ZeosDBO. ---------------------------------------------------------------------- Soner · 2021-06-18 06:36 Quote from: mmelwin on June 18, 2021, 07:41:14 amI still don't know how to prevent it. I don't want to switch to ZeosDBO. ZEOS loads all Data once, SQLDB didn't. As I said in other topic your program has no error. But you can still force SQLDB loading all data once like in ZEOS, move the cursor after activating query to the last row: 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  SQLQuery1.Active:=True; SQLQuery1.Last;             // <--- ADD this line  Edit: Don't forget it can take a long time to load 400mb over the network especially when the network is bussy. ---------------------------------------------------------------------- mmelwin · 2021-06-18 06:49 I think I've found the problem. Out of memory. Everything is fine after compiling to x64. I just need to find some other solution, because I have several computers with Win XP 32bit ---------------------------------------------------------------------- Handoko · 2021-06-18 13:03 Quote from: mmelwin on June 18, 2021, 08:49:04 amI just need to find some other solution ... I currently write a database program using Firebird. I need it to be more fault tolerance. So the program should not open, use and share a single connection for the whole runtime. When needed, for example user clicks a button, it automatically creates and sets a database connection, runs the query, then closes and frees the connection immediately. It keeps the connection active as short as possible, if something bad happens the chances to 'damage' the database becomes lower. For that reason, it cannot use TDBGrid. Instead it uses TStringGrid. For showing the data on the grid, it connects to the database, runs a query to read 20 items and closes the connection immediately. The form has a previous page and next page buttons. And you need to manually keep which page number is currently showing. I tested the concept using some generated data (50k records), it seemed to work correctly and there wasn't any noticeable performance impact. Maybe you can use the trick, by loading only a small amount of the data (a page), it should use very little amount of memory.