Recent

Author Topic: Keeping a record in view after committing an edit  (Read 1881 times)

hakelm

  • Full Member
  • ***
  • Posts: 153
Keeping a record in view after committing an edit
« on: February 13, 2018, 09:22:34 pm »
When I edit and commit data in a TDBgrid the TSQLTransaction is closed.
Reactivation of the SQLQuery and the SQLTransaction places the focus again on the first field of the first record in the query result.
How can I keep the record I edited in view so I can see what I just did i.e. how do I return to the table row I was on?
H

JanRoza

  • Hero Member
  • *****
  • Posts: 672
    • http://www.silentwings.nl
Re: Keeping a record in view after committing an edit
« Reply #1 on: February 13, 2018, 09:38:06 pm »
Use commitretaining instead of commit.
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
       Lazarus 3.2 FPC 3.2.2
       CodeTyphon 8.40 FPC 3.3.1

hakelm

  • Full Member
  • ***
  • Posts: 153
Re: Keeping a record in view after committing an edit
« Reply #2 on: February 13, 2018, 09:59:36 pm »
Thanks!
CommitRetaining did the trick.
H

talorigomat

  • Jr. Member
  • **
  • Posts: 96
Re: Keeping a record in view after committing an edit
« Reply #3 on: February 14, 2018, 03:36:44 pm »
With the SQLQuery component you can also set the property sqoKeepOpenOnCommit to True which may be a better option.  You can find this under Options on the property tab of the object inspector
Lazarus 1.8.0Rc4, Windows 10

 

TinyPortal © 2005-2018