problem with tdbgrid reload lazarus / 63-Database ---------------------------------------------------------------------- Gebony · 2019-05-08 16:00 please help; I have tried to reload data from database after adding or deleting or updating data but no use. I have tried these codes: 1-      sqlquery.close;      sqlquery.open; 2-     sqlquery.sql.clear;     sqlquery.sql.text:='select * from table';     sqlquery.open; 3-     dbgrid.datasource.dataset.refresh; 4-     sqlquery.active:=false;     sqlquery.active:=true; these all codes not working and I must close the app and run it again to reload the new data. ---------------------------------------------------------------------- valdir.marcos · 2019-05-09 06:51 Quote from: Gebony on May 08, 2019, 06:00:32 pmplease help; I have tried to reload data from database after adding or deleting or updating data but no use. I have tried these codes: 1-      sqlquery.close;      sqlquery.open; 2-     sqlquery.sql.clear;     sqlquery.sql.text:='select * from table';     sqlquery.open; 3-     dbgrid.datasource.dataset.refresh; 4-     sqlquery.active:=false;     sqlquery.active:=true; these all codes not working and I must close the app and run it again to reload the new data.Have you committed your transaction before reloading your data? http://wiki.freepascal.org/SQLdb_Programming_Reference http://wiki.lazarus.freepascal.org/SqlDBHowto ---------------------------------------------------------------------- nouzi · 2019-05-09 10:07 try tihs 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 TDataModule1.NametableAfterPost(DataSet: TDataSet);begin   Nametable.Refresh;end; ---------------------------------------------------------------------- Gebony · 2019-05-09 11:35 QuoteHave you committed your transaction before reloading your data? of course i have committed it. ---------------------------------------------------------------------- Gebony · 2019-05-09 11:36 Quote from: nouzi on May 09, 2019, 12:07:42 pmtry tihs 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 TDataModule1.NametableAfterPost(DataSet: TDataSet);begin   Nametable.Refresh;end;     I haven't used datamodule. ---------------------------------------------------------------------- nouzi · 2019-05-09 16:15 Quote from: Gebony on May 09, 2019, 01:36:59 pmQuote from: nouzi on May 09, 2019, 12:07:42 pmtry tihs 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 TDataModule1.NametableAfterPost(DataSet: TDataSet);begin   Nametable.Refresh;end;      I haven't used datamodule. Change to what suits your code Name form example ---------------------------------------------------------------------- valdir.marcos · 2019-05-09 17:32 Quote from: Gebony on May 09, 2019, 01:35:18 pmQuoteHave you committed your transaction before reloading your data?of course i have committed it.Please, upload a sample project with sample data so we can help you better. ---------------------------------------------------------------------- nouzi · 2019-05-09 17:51 Quote from: Gebony on May 09, 2019, 01:36:59 pmQuote from: nouzi on May 09, 2019, 12:07:42 pmtry tihs 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 TDataModule1.NametableAfterPost(DataSet: TDataSet);begin   Nametable.Refresh;end;      I haven't used datamodule. Change to what suits your code Name form example ---------------------------------------------------------------------- Gebony · 2019-05-10 11:21 I am rewriting the project with datamodule object and I will try it ---------------------------------------------------------------------- Gebony · 2019-05-13 10:22 I wrote the code of loading data in formactivate event and i call it from any form. but there is new problem when i call the field id  appear a message "field not found" 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 dbgrid1.datsource.dataset.fieldbyname('id').asinteger ---------------------------------------------------------------------- Gebony · 2019-05-20 12:20 thanks for all.I have solved it.