My program uses a datamodule which contains the connection, the transaction and all queries and in the datamodule oncreate procedure I have the following code:
procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
// Open database
DbConnection.Connected := False;
DbConnection.DatabaseName := SysUtils.ExtractFilePath(ParamStr(0)) + 'GliderMaintenance.db';
DbConnection.Connected := True;
// Open all tables
qryCertificatenLog.Active := True;
Running my program in the Lazarus IDE and running the program in the development folder gives no problem but as soon as I copy the program, the database and the SQLite dll to a different folder and run it there it give an error message "dbconnection: Unable to close due to unfinalized statements or unfinished backups" (see attached screenshot).
This error occurs when executing the statement in line 9.
The weird thing is that the error says that dbconnection wants to close whereas nowhere there is a close statement. It should stay connected and the query should be activated.
What am I doing wrong? Why does it run in its source folder and give an error when running elsewhere?
Any advise would be more than welcome.
(running Lazarus 1.6RC2 / FPC 3.0.0)