TBufDataset+TDBGrid basic application problem (new records disappear) lazarus / 16-Databases ---------------------------------------------------------------------- e5431 · 2026-03-20 20:07 Hi everyone! I'm trying to make a simple BufDataset application for storing a name list in a BufDataset in Lazarus 4.2+FPC 3.2.2 on Win 10 x64. I put  TBufDataset, TDataSource, TDBGrid and TDBNavigator on my form with DataSet and DataSource properties filled. When I run the application and click Insert button and type in a name, press Enter and then click Post, the name disappears from the grid (I've attached a gif for illustration). If I keep adding new records, the new ones disappear after Post as well. But sometimes some of them appear in the grid again. When closing the application I get 'External: ACCESS VIOLATION' with message Access violation reading from address $FFFFFFFFFFFFFFFF. I can't understand what I do wrong. There is no code at all! I recall when I wrote a similar app in Dephi 7, it worked fine. Please help me to fix the issue. PS: the archive with Lazarus project attached ---------------------------------------------------------------------- olatov · 2026-03-20 23:06 Hi, I've tried your project (built using Lazarus 4.6 / FPC trunk under Linux) and it seems to be fine, can't see any problem. Insert, edit, delete, post all work as expected. Perhaps something's up with specific FPC/Laz version? ---------------------------------------------------------------------- wp · 2026-03-21 00:36 Running your demo on Laz/main+FPC3.2.2 (32-bit) on Windows 11 I do get the same issue: only empty cells in the grid. Your code contains persistent fields and designtime-created index defs. I am aware that that Lazarus/FPC are doing a bad job with databases at designtime. Maybe this has improved with FPC-trunkl because Nimbus does not see this issue (TBufDataset resides in FPC, not in Lazarus). Usually it helps to avoid designtime operations with databases and do everything at runtime. I deleted the persistent field and the indexdefs - and suffered from some Lazarus crashes along the way. The better way probably is to delete the BufDataset altogether and just add a default one again. Then, use the OnCreate handler of the form to define the fields and indexes by code: 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 TForm1.FormCreate(Sender: TObject);begin  BufDataset1.FieldDefs.Add('Name', ftString, 100);  Bufdataset1.IndexDefs.Add('ASCENDING_ORDER', 'Name', []);  Bufdataset1.IndexDefs.Add('DESCENDING_ORDER', 'Name', [ixDescending]);  BufDataset1.IndexName := 'DESCENDING_ORDER';  BufDataset1.CreateDataset;  BufDataset1.Open;  DBGrid1.Columns[0].Width := 100;end; This modification is running fine. ---------------------------------------------------------------------- e5431 · 2026-03-21 03:19 wp: Thank you! It really works. I hope it will be possible someday to do the things in design time without problems. ---------------------------------------------------------------------- valdir.marcos · 2026-03-21 03:48 Quote from: wp on March 21, 2026, 01:36:04 amRunning your demo on Laz/main+FPC3.2.2 (32-bit) on Windows 11 I do get the same issue: only empty cells in the grid. Your code contains persistent fields and designtime-created index defs. I am aware that that Lazarus/FPC are doing a bad job with databases at designtime. Maybe this has improved with FPC-trunkl because Nimbus does not see this issue (TBufDataset resides in FPC, not in Lazarus). Usually it helps to avoid designtime operations with databases and do everything at runtime. I deleted the persistent field and the indexdefs - and suffered from some Lazarus crashes along the way. The better way probably is to delete the BufDataset altogether and just add a default one again. Then, use the OnCreate handler of the form to define the fields and indexes by code: 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 TForm1.FormCreate(Sender: TObject);begin  BufDataset1.FieldDefs.Add('Name', ftString, 100);  Bufdataset1.IndexDefs.Add('ASCENDING_ORDER', 'Name', []);  Bufdataset1.IndexDefs.Add('DESCENDING_ORDER', 'Name', [ixDescending]);  BufDataset1.IndexName := 'DESCENDING_ORDER';  BufDataset1.CreateDataset;  BufDataset1.Open;  DBGrid1.Columns[0].Width := 100;end; This modification is running fine. Interesting.