TDBGrid: how to edit data lazarus / 16-Databases ---------------------------------------------------------------------- jshand2010 · 2013-03-05 09:56 what settings must you have right before the grid will show and enable you to edit the information. TPQConnection: i have set it up to connect to a database with the right username nad password and connects without a problem. TSQLQuery: i have connected to TPQConnection, left Datasource blank.  transaction is correctly chosen.  in sql i have selected all from the product table.  set active to true TSQLTransaction: This is pretty straight forward. TDatasource: i have connected the datasource to the TSQLQuery. DBGrid: i have set the datasource to the datasource.  set all titles to corresponding fields and connected all the fields. ---------------------------------------------------------------------- teos · 2013-04-06 13:49 If you set TSQLQuery active and it supports editing, the DBGrid will show editable data. From the properties, I suppose you need to enter SQL in the insertsql and updatesql properties. I'm sure someone can improve my answer but maybe it's a pointer in the right direction. ---------------------------------------------------------------------- u2o · 2013-04-06 15:54 Hi! Maybe you need to define more connections... This is an example for Sqlite3... Code: [Select]procedure TfrmSeeBook.ButtonShowMeBooks_OnClick(Sender: TObject); begin    Sqlite3Dataset1.FileName := 'sqlite3.db';   Sqlite3Dataset1.TableName := 'books';   Sqlite3Dataset1.PrimaryKey := 'book_id';   DataSource1.DataSet := Sqlite3Dataset;   Sqlite3Dataset1.SQL :=  'SELECT * FROM books WHERE active="1" ORDER BY book_id';   DBGrid1.DataSource := DataSource1;   DBNavigator1.DataSource := DataSource1;   Sqlite3Dataset1.ExecSQL;   Sqlite3Dataset1.Open;   Sqlite3Dataset1.Active := True;   Sqlite3Dataset1.SaveOnClose := True;   Sqlite3Dataset1.SaveOnRefetch := True; end; ---------------------------------------------------------------------- Russell · 2024-07-04 03:13 Under lazarus the TSQLQuery has 5 options (in my version - 2.2.0 on windows 64) When I set sqoAutoApplyUpdates, sqoAutoCommit and sqoKeepOpenOnCommit each to true, the TDBGrid started saving my data. Otherwise, I had everything as stated in the original question. Russell