[SOLVED] Update data using a query lazarus / 16-Databases ---------------------------------------------------------------------- madref · 2016-09-19 12:43 I have the following query which is build from 2 tables. Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CREATE VIEW qry_Overzicht_Leden AS SELECT tbl_Personen.Lid_ID, Lid_Achternaam, Lid_Tussenvoegsel, Lid_Voornaam, Lid_Initialen, Lid_Adres, Lid_Postcode, Lid_Woonplaats, Lid_Telefoon, Lid_Mobiel, Lid_Geb_datum, Lid_Geb_plaats, Lid_Email, Lid_Geslacht, Lid_NIJB_nr, Lid_Opmerkingen, Lid_Sinds, Lid_Stop, Lid_Identificatie, Lid_Inschrijfformulier, Lid_BSN, Lid_Geroyeerd, Lid_Banknr, Lid_tnv FROM tbl_Personen INNER JOIN tbl_Personen_Leden ON tbl_Personen.Lid_ID = tbl_Personen_Leden.Lid_ID ORDER BY Lid_Achternaam, Lid_VoornaamAl this is made visible in a form with database-aware fields (Like DBEdit and others). After the changes have been made i want to update these fields. But how to do that? The form is show when this is being called: 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 TForm_Invoer_Lid.ShowLid(ID: integer);var cSQL, s: String;    i: integer;begin  TQ_Lid.Active := false;  cSQL := 'SELECT * FROM qry_Overzicht_Leden WHERE Lid_ID = :ID;';  TQ_Lid.DataBase := DB_Info.Connect_DB;  TQ_Lid.SQL.Text := cSQL;  TQ_Lid.ParamByName('ID').AsInteger := ID;   TQ_Lid.Edit;...  ShowModal;end;     // ShowLid   ... and when a button is pressed the form gets updated and close with... 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 TForm_Invoer_Lid.UpdateLid;begin  if TQ_Lid.State in [dsEdit, dsInsert] then  begin    TQ_Lid.Post;    TQ_Lid.ApplyUpdates;    if DB_Info.Trans_DB.Active then      DB_Info.Trans_DB.CommitRetaining;  end;end;     // UpdateLid  While i am trying to update i get an error: Cannot modify qry_Overzicht_Leden because it is in view ---------------------------------------------------------------------- rvk · 2016-09-19 12:51 Quote from: madref on September 19, 2016, 02:43:24 pmAfter the changes have been made i want to update these fields. But how to do that? That would depend on what fields. If the fields are in different tables you can't do this with one statement. You would need to create two (or more) statements which you could execute with ExecSQL. TQ_Lid.Edit; Does this line work? Doesn't it generate an exception (can't create update-query or something)? QuoteYou cannot DELETE, INSERT, or UPDATE a view. Views are read-only in SQLite. ---------------------------------------------------------------------- madref · 2016-09-19 12:56 Damn thats what i thought