Does the exception occur for all 4 enum-values? or for only one specific?
any "visual" DB-components accessing the db "directly"?
Because i agree: Can't see anything wrong, either, provided all 3 objects (Connection, Transaction, Query) are connected to each other properly
EDIT: The only thing "fishy" to me is the Rollback in line 8.
Is it possible you have a CREATE TABLE somewhere, which is pending?
Maybe change that Create Table statement to
CREATE TABLE IF NOT EXISTS TAppointments.......
That way it would be a no-op if the table already exists, and no you wouldn't lose any data already in that table.
Remember: CREATE TABLE is a Transactional Statement in SQLite
https://www.sqlite.org/lang_transaction.htmla write transaction is started by statements like CREATE, DELETE, DROP, INSERT, or UPDATE (collectively "write statements")