SQLite3+Foreign Key+Cascade lazarus / 16-Databases ---------------------------------------------------------------------- Martin Lowry · 2016-03-19 09:38 Hi Like Vingadero (http://forum.lazarus.freepascal.org/index.php?topic=15477.0) in December 2011 I can't get the subject combination to work.  I'm using the most recent versions of Lazarus, FPC, SQLite3 and DB Browser for SQLite3 and tables with the appropriate schemas. I've checked sqlite3.pp and it has the necessary fix reported in http://bugs.freepascal.org/view.php?id=20865 but I still can't get 'foreign_keys = 1' to stick (added to Params in OnBeforeConnect).  Querying the value in OnAfterConnect always returns a value of 0. Very frustrating Any help much appreciated. ---------------------------------------------------------------------- rvk · 2016-03-19 14:50 One little typo. Don't use spaces between "=" in the parameters  You could also set it in the parameters in the object inspector, or if you create your connection in code just after the .Create instead of in the OnBeforeConnect. But the main problem are the spaces. So it should be something like this: 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 SQLite3Connection1.DatabaseName := Filename;SQLite3Connection1.Params.Add('foreign_keys=1'); // or =onSQLite3Connection1.Connected := True; ---------------------------------------------------------------------- Martin Lowry · 2016-03-20 09:43 Hi, Thanks rvk!  Of course!  The spaces don't matter when posting 'PRAGMA foreign_keys = 1' to the DB directly through execsql but when extracted from Params by Name and Value they are quite significant Cheers!