PDA

Click to See Complete Forum and Search --> : About Transaction!


haha
Jun 25th, 1999, 07:16 AM
I have some problems when I am using VB.
I use "OpenDatabase" and "OpenTable" in my program.
When I commited a transaction,it is O.K.if I do not use a Data control.But if I use a Data control, and commit a transcation I open mannually, I cannot commit it for the second time even though I open another transaction. How can I begin another transaction? For example,I use a Data control, begin a transaction for a database and commit it. Though I use the "begintrans" before I commit it for the second time, it always says I try to commit the translation without beginning the translation. Do you know why? I hope you can offer me some information.in my program,too. Thanks.
Yours
The following codes are used to open a database. I guess the problem may be there.
Private Sub OpenFile_Click()
Dim bl As Integer
On Error Resume Next
Dim n As Integer
If ValueText.Text <> "" Then
bl = MsgBox("Do you want to save changes to the file?", vbYesNoCancel, "Message")
If bl = 6 Then ws.CommitTrans
If bl = 7 Then ws.Rollback
If bl = 2 Then Exit Sub
End If
db.Close
ws.Close
DBCommonDialog.ShowOpen
If Err = 32755 Or DBCommonDialog.filename = "" Then Exit Sub
DatabaseText.Text = DBCommonDialog.filename
Set ws = DBEngine.Workspaces(0)
ws.BeginTrans
Set db = ws.OpenDatabase(DatabaseText.Text)
......
End Sub

Aaron Young
Jun 25th, 1999, 07:50 AM
Try calling WS.BeginTrans after you open the Database.

- Aaron.