Recent

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

hakelm

  • Jr. Member
  • **
  • Posts: 99
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: 507
    • 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)
Laz: Lazarus 2.0 FPC 3.0.4 i386-win32-win32/win64

hakelm

  • Jr. Member
  • **
  • Posts: 99
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