Sorry for my bad English.
A few years ago, I wrote a program in Delphi + SQLite, which I use on a daily basis for my professional needs. I'm working with a Database which have 60 tables I open/close as needed. It works perfectly, but I'm looking to migrate to Lazarus.
I'm working under Windows 10/11, Lazarus 2.2.6, Zeos 7.14.2, SQlite 3.43.2. Before writing these topic, I spend time to read about SQLite and AutoCommit and I've tried the proposed solutions without success. I can't solve my probleme.
Here my Table describer :
Code: Select all
CREATE TABLE AFFECTIONS (
ID_AFFECTION INTEGER PRIMARY KEY ASC ON CONFLICT ROLLBACK AUTOINCREMENT
UNIQUE ON CONFLICT ROLLBACK
NOT NULL
DEFAULT (0),
AFFECTION VARCHAR (75) DEFAULT ('')
In the DataModule, I have :
Code: Select all
procedure TDataModule1.TAffectionsAfterPost(DataSet: TDataSet);
begin
DataModule1.TAffections.Edit;
DataModule1.TAffections.Post;
DataModule1.Connexion.AutoCommit := False;
DataModule1.Connexion.Commit;
DataModule1.Connexion.AutoCommit := True;
end;
procedure TDataModule1.ConnexionCommit(Sender: TObject);
begin
ShowMessage('Données enregistrées'); (Data registered...)
end;
SQL :
Code: Select all
SELECT ID_AFFECTION, AFFECTION
FROM AFFECTIONS
In Delphi, Id_Affection appear when I click on Post button but not here... So I have to write it by hand or it indicate 0 (see below).
I therefore enter the data by hand, including the number of the incremented field. If I don't enter it and I Post, it displays 0 (the normal default value...). If I enter a number (last_rowid + 1), I can enter Affection, but the program freezes after...
When I quit the program and open it, data are there, but if I try to modify them, the program freezes too. I see them in SQLite Studio too.
Better still, the dBNavigator blocks if I want to modify, refresh or delete... the input!
Where is my mistake? Why does dBNavigator block when adding, modifying, cancelling or refreshing?
I'm not a programmer, but I do a bit of programming. Thanks for help.