Many beginners do not understand the relationship among database (and transaction), datasets and visual controls. You'd better to think of a three layer.
(A) (B) (C)
Database file TDataSet descendants (TDatasource) TDataControls
(SQLite, Firebird, MariaDB) (TSQLQuery, etc.) (TDBEdit, TDBGrid, etc.)
1. When you open an SQL of TSQLQuery (or other query) , e.g. "select * from table1", records are selected within server (A), and a copy of them are sent to DataSet(B). The content is visually shown in the data controls (C).
2. TDataset operations, insert, edit, post, etc. are done to this TDataSet (local copy, B). But these are not reflected in the A in itself.
3. The changes done to B should be updated to A, for them to be permanently stored. This is done by TDataSet.ApplyUpdates, or other SQL statements, like insert into table1 (f1, f2) values (v1, v2);", or "update table1 set f1=v1", etc. depending on the connection type.
4. Transactions are applied to the server side(A).
It defines a block of operations to stored or cancelled late. Followings are general order.
Transaction.StartTransaction
// do operations -- insert, update, or delete of records in the database
Transaction.Commit or Rollback
--> the changes since the start of transaction are stored if committed, and discarded if rolled back.
Transaction is not directly related with with local copy, i.e. TDataSet(B). For example,
with ZQuery do begin
Open;
// Insert into (B)
insert;
FieldByName('numero').AsString := Edit1.Text;
FieldByName('fecha').AsDateTime:=Now;
FieldByName('nombre').AsString:= Edit1.Name; // => this is strange. Edit1.Name is always Edit1. Anyway,
post;
// Save to (A)
Transaction1.StartTransaction;
Yquery.SQL:= Format ('insert into table1 values (%d, ''%s'', ''%s'')',
[FieldByName('numero').AsInteger, FieldByName('fecha').AsString, FieldByName('nomber').AsString]);
yquery.execsql;
Transaction1.CommitRetaining; // Commit closes the dataset, ZQuery.
// Insert into (B)
insert;
FieldByName('numero').AsString := Edit2.Text;
FieldByName('fecha').AsDateTime:=Now;
FieldByName('nombre').AsString:= Edit2.Name;
post;
// second insertion is not saved to DB (A).
showmessage('do you see edit2.content?');
Close;
// you many need starttransaction here.
Open;
showmessage('do you still see edit2.content?');
end;
In this case, you will see contents of both Edit1 and Edit2 on (C), but your server has only Edit1's content. You can confirm this just by Closing and reopening ZQuery.
Memory-resident datasets, like TBufDataSet, do not have (A). There are only (B) and (C). But the operations done to these are also to the copy within memory. To save them, you have to store it to a file or in other ways.
So, whatever stay in TDataSet descendants are stay just in memory, not on a permanent media.
I'm writing this because I spent many days to finally grasp this relationship (and no problem in writing programs afterwards. Hope other beginners do not waste time. If you already know this, and this is not point of your question, just forgive me

.