PRB: Dynaset Loses Contents After Transaction Rollback (109995)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q109995 SYMPTOMS
If a Dynaset is used in a transaction, records in the Dynaset appear to
be lost when the transaction is rolled back.
CAUSE
This is by design. A Dynaset is populated one record at a time, so the
RollBack operation removes all the records added during the transaction.
After the RollBack operation, the Dynaset contains the single record that
was there before BeginTrans began the transaction.
RESOLUTION
Create the complete Dynaset before starting the transaction. For example,
replace the code shown in step 3 of the More Information section with this
code:
Sub Command1_Click ()
Dim db As database
Dim ds As Dynaset
Set db = OpenDatabase("Biblio.mdb")
Set ds = db.CreateDynaset("authors")
' Create the complete Dynaset before starting the transaction.
ds.MoveLast
ds.MoveFirst
' Populate the listbox with the contents of the Dynaset.
BeginTrans
While Not ds.EOF
list1.AddItem ds(0)
ds.MoveNext
Wend
Rollback
ds.MoveFirst
While Not ds.EOF
list2.AddItem ds(0)
ds.MoveNext
Wend
End Sub
STATUS
This behaviour is by design.
Modification Type: | Major | Last Reviewed: | 10/30/2003 |
---|
Keywords: | kbprb KB109995 |
---|
|