Master Detail with SQlite3 lazarus / 16-Databases ---------------------------------------------------------------------- folkeu08 · 2021-07-09 09:36 Good morning all, I started from an example of Master / Detail tables under SQLite3. I don't want to use the DBNavigator component to manage the records of my tables. I would like to replace it with 3 simple buttons: Add, Edit and delete. It works great for the Master table. I used the same method for the detail table but I get an error message when I want to add a city in record. It cannot find the City_mane field in the SQLQuery1 which corresponds to the master (countries) table or this field is in the Detail (Cities) table. By forcing the recorder, the recording starts again and goes well. The new city attached to the country appears in the grid. I attach my source to you, there may be something that escapes me. Thank you Francois ---------------------------------------------------------------------- devEric69 · 2021-07-09 13:23 Quote from: folkeu08 on July 09, 2021, 11:36:39 amI don't want to use the DBNavigator component to manage the records of my tables. I would like to replace it with 3 simple buttons: Add, Edit and delete. Hello, (just for information, to be sure) did you know that you can make certain DBNavigator's buttons invisible? ---------------------------------------------------------------------- folkeu08 · 2021-07-09 13:56 Yes but I just left the DBnavigator as in the original source of the example. I don't want to use them at all. François ---------------------------------------------------------------------- wp · 2021-07-09 15:30 Then remove it. What's the problem? Add your three buttons. Add a TActionList. Add these standard actions to the Actionlist: TDatasetEdit, TDatasetDelete, TDatasetInsert (or whatever you need); link the actions to your dataset. Put the actions into the Action property of the buttons - done. ---------------------------------------------------------------------- folkeu08 · 2021-07-09 15:54 This is what I did indirectly with my 3 buttons. It is the addition of a row in the detail table that goes wrong. I can't find the problem. ---------------------------------------------------------------------- wp · 2021-07-09 18:55 http://www.festra.com/fp/sqlite04.htm contains two master-detail tables with sqlite3. In the attachment there is a modified version in which I removed the dbNavigator of the detail table and replaced its functionality by five buttons (Insert, Edit, Delete, Post, Cancel) which use standard actions as I described above. -- It is working correctly. ---------------------------------------------------------------------- folkeu08 · 2021-07-09 20:28 Thanks for your attention wp. What you propose, I know how to do. What I'm having trouble with in my attached source: - By clicking on the button for adding data in the detail table, it opens a modal window containing non-DB fields.  - in this modal window, by clicking this time on the record button, the data contained in the simple fields must be recorded in the table. When this registered button is clicked, I am told that the "City_name" field does not exist in the master table. This is normal since it is present in the detail table. This stops the registration process. Thanks ---------------------------------------------------------------------- Zvoni · 2021-07-12 06:54 Is it "city-mane" or "city_name"? ---------------------------------------------------------------------- folkeu08 · 2021-07-13 14:43 Hi, It's "city_name". Thanks ---------------------------------------------------------------------- Jurassic Pork · 2021-07-13 15:13 hello folkeu08, have you try what i have suggested in the french lazarus forum here. Friendly, J.P ---------------------------------------------------------------------- folkeu08 · 2021-07-13 16:59 Hi Jurassic Pork, Yes, I have try it but not on the SQLquery2. I close the SQLQuery1 and it search not the "City_Mane" field. I must modifie the rest of the code to open after the SQLQuery1 for view the two grid. I will resubmit my code afterwards because I am not sure that it is "clean" as it says in the middle. I am an amateur! François