Hi, I'm a new user for lazarus. I have tried the Master-Detail tutorial, everything is ok. I tried to save the detail record to the sqlite using the tsqleury post and applyupdate, the screen is ok, but actually not in the sqlite database. I don't know why?
Mailing lists / lazarus / 2014-02
save the detail record to sqlite
6 messages · 3 people ·
- RReinier Olislagers 3
- AAntonio Fortuny 2
- Ttce tce 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
tce tce wroteHi, I'm a new user for lazarus. I have tried the Master-Detail tutorial, everything is ok. I tried to save the detail record to the sqlite using the tsqleury post and applyupdate, the screen is ok, but actually not in the sqlite database. I don't know why?
Thanks for describing your problem a bit but... how do we know what you did wrong if you don't give more details, such as:
- which tutorial did you use (URL - there are multiple master/detail tutorials)
- the code you use?
However, I polished my crystal ball and my guess is that you forgot this step:
http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key ...
Thanks,
Reinier
Note: also posted on forum:
forum.lazarus.freepascal.org/index.php/topic,23766
Le 28/02/2014 10:09, Reinier Olislagers a ?crit :
However, I polished my crystal ball and my guess is that you forgot this step: http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key ... Thanks, Reinier Note: also posted on forum:
I guess that your cristal ball brights a lot after polishing it ( how much time: 10 minutes a day maybe ?) 8-)
Mine desn't like polishing so I've built a bunch of rules for this kind of situation where updatable datasets are involved:
- always assign an OnNewRecord event and dive the default value to all defined fields (TFields list). I know, some DBMS do it for you, but ... on creating the client dataset record, setting the master dataset key is always the first line, process generators, etc.
- always explicitely name the used fields in the commanding Sql (any error on connecting to the DB will raise an error)
This prevents me to trust my memory too much.
Antonio.
forum.lazarus.freepascal.org/index.php/topic,23766 -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com
Antonio Fortuny wrote 10 lines
Hi Antonio,
If you want to change/update/improve the tutorial article, be my guest ;)
Thanks,
Reinier
Le 28/02/2014 11:48, Reinier Olislagers a ?crit :
Show quoted text 14 lines
I'd be happy to write some advices as far as you could consider them as some improvement to the DataSet processing.
I guess you mean the wiki page
http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key These are not specifically addressed to the master-detail relationship but specifically to the DataSet itself in a more general way. I can then give the exhaustive list of rules I follow since years. You could give some ideas on where to write tese rules. As a first approach I can point the "SQLDB implementation" chapter.
Antonio.
Show quoted text 10 lines
---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com
Antonio Fortuny wroteI'd be happy to write some advices as far as you could consider them as some improvement to the DataSet processing. I guess you mean the wiki page http://wiki.lazarus.freepascal.org/MasterDetail#Adding_detail_records_with_the_right_foreign_key
Yes, that's sort of why I posted the link earlier in the thread...
Show quoted text 5 lines
As I said, you're welcome to update the master/detail page. It's up to you what to write and where to write what... as long as it fits in with the rest of the tutorial...
If you want to update other database pages: likewise, please feel free - I really appreciate other people contributing!
(Possible locations: the working with sqlquery page, the database faq page.... perhaps there's something better)
However, I don't want to be some kind of editor that is going to pre-approve what gets written as
1. I have other things to do
2. I'm not a GUI guy at all and prefer letting people who know what they're doing just do their stuff
Thanks,
Reinier
