[Lazarus] How to do insert/update and select on database

Michael Van Canneyt michael at freepascal.org
Sun Jun 2 22:55:20 CEST 2019

On Sun, 2 Jun 2019, Darius Blaszyk via lazarus wrote:

> Hi,
> I'm new to database programming with Lazarus. So hence possible a couple of
> obvious questions!
> I would like to do inserts, selects, and updates on a single SQLite
> database. I am now using multiple SQLQuery components with all their own
> queries. Is this the way it should work?

It is one way to work. I usually do the same.

> After a commit, the SQLQuery that populates the DBGrid is closed. Is this
> supposed to happen? The transaction component is set to caCommitRetaining.
> I believe I read somewhere that it should remain open in that case.

No, this is not what it means. You should avoid caCommitRetaining.

There is an option on TSQLQuery, sqoKeepOpenOnCommit

Documented here:


It does what you want.


More information about the lazarus mailing list