Results 1 to 2 of 2

Thread: About Transaction!

  1. #1

    Thread Starter
    New Member
    Join Date
    May 1999
    Location
    Guangzhou,GuangDong,China
    Posts
    1

    Post

    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


  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Try calling WS.BeginTrans after you open the Database.

    - Aaron.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width