Recent

Author Topic: Updates made to detail dataset are vanished when the master dataset record moves  (Read 1285 times)

salah

  • Newbie
  • Posts: 5
Hi guys
I'am working on simple project of master/detail dataset using TSQLQuery of SQLDB (Lazarus 2.0.6, Firebird 3, Windows 7 32 bit), and here is my problem:

All updates made to detail dataset are vanished whenever the master dataset active record moves!
I think this is because the detail dataset is refreshed, but the option sqoCancelUpdatesOnRefresh is set to false

Changes in the detail dataset are kept if I call ApplyUpdates method, but I don't want to apply update every time I scroll in the master dataset!

Can anyone find a solution?
Thanks ;)
« Last Edit: December 30, 2019, 11:56:15 am by salah »

devEric69

  • Hero Member
  • *****
  • Posts: 648
For your information, afaik, you must absolutely POST the changes (insert \edit \delete) of the detail record(s), before you POST the master record!
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

nouzi

  • Sr. Member
  • ****
  • Posts: 314
@salah
welcome
see this first
https://www.youtube.com/channel/UCaZ7RZJa4il7gL2v-jGHa8Q/playlists
---------
you can use zeosdb package
My English is  bad
Lazarus last version free pascal last version
Lazarus trunk  free pascal trunk 
System : Linux mint  64bit  Windows 7 64bit

salah

  • Newbie
  • Posts: 5
@salah
welcome
see this first
https://www.youtube.com/channel/UCaZ7RZJa4il7gL2v-jGHa8Q/playlists
---------
you can use zeosdb package

i found it very useful, thanks  8)

devEric69

  • Hero Member
  • *****
  • Posts: 648
Quote
[snip]...Firebird 3...[snip]

Zeos are good components (I use them with MariaDb)..
But, amho, IBX components are much more adapted to Firebird's features and technical specifications (I use IBX wth Firebird): TIBDataset handles the master details very well, and TIBQuery can be used for LookupDataset.
You can do some research on the forum, and you will see that IBX is often used with Firebird.
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

salah

  • Newbie
  • Posts: 5
Quote
[snip]...Firebird 3...[snip]

Zeos are good components (I use them with MariaDb)..
But, amho, IBX components are much more adapted to Firebird's features and technical specifications (I use IBX wth Firebird): TIBDataset handles the master details very well, and TIBQuery can be used for LookupDataset.
You can do some research on the forum, and you will see that IBX is often used with Firebird.

Thank you for your fast reply, I will try to use IBX.

devEric69

  • Hero Member
  • *****
  • Posts: 648
Quote
Thank you for your fast reply, I will try to use IBX.

As a reminder, in Master-Details with IBX, the trick not to forget is to add in the TIBdetails.SelectSQL (Cf. the comments /* ... */) a WHERE clause like that:

Code: MySQL  [Select][+][-]
  1. SELECT ...
  2. Details A
  3. /* add here, a WHERE statement, to fetch the master key value, through its TIBXdetails.DataSource property */
  4. A.MASTER_ID = :MASTER_ID
  5. /* add eventually, another ORDER BY statement, if needed */
  6.  
use: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

 

TinyPortal © 2005-2018