Ik heb een klein basis programmaatje gemaakt alleen om mijzelf te leren omgaan met transactions, interbase en delphi 5. Nu zit ik met het probleem dat als ik in het ene programma een wijziging heb aangebracht dat het in het andere programma niet zichtbaar is. Ik heb hiervoor al gekeken op community.borland.com maar daar kan ik geen goed antwoordvinden:
borland:
All changes made to the database must be committed before the changes can be visible to others. When another user actually sees the committed changes depends on the transaction isolation level they are using. If another user is using snapshot isolation he/she will not see the change until he/she commits and starts a new transaction. If he/she is using read committed isolation he/she will see the change the nest time he/she selects the changed record.
Wat heb ik dan in onderstaande code fout gedaan?
IK heb 2 forms, op form1 staat 1x ibdatabase, 1x ibtransaction, 1x ibtable, 1x tdatasource, 1x button1
op form1 staat 1x dbgrid, 1x button1
Form2:
form1:
Opmerking: Als ik starttransaction verplaats van de form1.create naar het begin van button1click op form2 dan krijg ik de foutmelding: Transaction is active. En als ik commitrataining verander in commit is mijn dbgrid leeg.....
borland:
All changes made to the database must be committed before the changes can be visible to others. When another user actually sees the committed changes depends on the transaction isolation level they are using. If another user is using snapshot isolation he/she will not see the change until he/she commits and starts a new transaction. If he/she is using read committed isolation he/she will see the change the nest time he/she selects the changed record.
Wat heb ik dan in onderstaande code fout gedaan?
IK heb 2 forms, op form1 staat 1x ibdatabase, 1x ibtransaction, 1x ibtable, 1x tdatasource, 1x button1
op form1 staat 1x dbgrid, 1x button1
Form2:
code:
1
2
3
4
5
6
7
8
9
10
11
12
| procedure TForm2.FormShow(Sender: TObject); begin Form1.IBTable1.Open; end; procedure TForm2.Button1Click(Sender: TObject); begin Form1.IBTable1.edit; form1.IBTable1PROJECTNR.value:=edit1.text; Form1.IBTable1.Post; end; |
form1:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| procedure TForm1.FormCreate(Sender: TObject); begin IBDatabase1.Open; IBTransaction1.StartTransaction; end; procedure TForm1.Button1Click(Sender: TObject); begin form2.Show; end; procedure TForm1.IBTable1AfterPost(DataSet: TDataSet); begin IBDatabase1.ApplyUpdates([ibtable1]); IBTransaction1.CommitRetaining; end; |
Opmerking: Als ik starttransaction verplaats van de form1.create naar het begin van button1click op form2 dan krijg ik de foutmelding: Transaction is active. En als ik commitrataining verander in commit is mijn dbgrid leeg.....
Dell XPS 17 Intel i7 2630 Nvidia GT555 3Gb Hd1: OCZ Vertex 2 SSD 60 GB Hd2: 500Gb