Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2006
    Posts
    2

    Unhappy Unanswered: VB 6 & mysql database problem

    I wrote an application in vb6 that should manipulate a mysql database located on another pc.

    I had no problems (accessing & reading records) till I wanted to add something to the database and everytime I get this error:

    Error #3246 Connection object cannot be explicitly closed while in a transaction

    Where did I go wrong?
    Please help me!

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Quote Originally Posted by xtcvampire
    I wrote an application in vb6 that should manipulate a mysql database located on another pc.

    I had no problems (accessing & reading records) till I wanted to add something to the database and everytime I get this error:

    Error #3246 Connection object cannot be explicitly closed while in a transaction

    Where did I go wrong?
    Please help me!
    Until you show us the code, there's no way to see where you went wrong. Please post the code where you define and instanciate (Dim/set) your database objects, establish the connection and update the database.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    loquin is correct. Without knowing any of what you're code looks like we can only postulate that you have an open recordset or some such thing and have tried to explicitly close a connection.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Dec 2006
    Posts
    2

    Wink It is a adErrInTransaction #3246

    Connection object cannot be explicitly closed while in a transaction. A Recordset or Connection object that is currently participating in a transaction cannot be closed. Call either RollbackTrans or CommitTrans before closing the object.

  5. #5
    Join Date
    Dec 2006
    Posts
    2
    I kinda resolved the error above. But now another error is annoying me.
    Error 3021 Either BOF or EOF is True, or the current record has been deleted.

    any suggestions?
    here's my code:

    Code:
    Private Sub cmdOk_Click()
        On Error GoTo ERRHANDLER
        rst.Open "Select * from Departamente where Nume='" & cmbDepartamente.Text & " ' ", dbs
        txtCod.Text = rst!cod_departament
        rst.Close
        
        rst.Open "Cereri_angajati", dbs, adOpenKeyset, adLockOptimistic
        rst.AddNew
        rst!cnp = add_date.txtCNP.Text
        rst!cod_1 = txtCod.Text
        rst!PCA = chkParcare(0).Value
        rst!PCB = chkParcare(1).Value
        rst!PCD = chkParcare(2).Value
        rst!PCE = chkParcare(3).Value
        rst!PCF = chkParcare(4).Value
        rst!PCH = chkParcare(5).Value
        rst!PCC4a = chkParcare(6).Value
        rst!PCC4b = chkParcare(7).Value
        rst.Update
        rst.Requery
        rst.Close
        
        rst.Open "Angajati", dbs, adOpenKeyset, adLockOptimistic
        rst.Find "cnp='" & add_date.txtCNP.Text & "'"
        rst.Fields("functia").Value = txtFunctia.Text
        rst.Update
        rst.Close
        dbs.Close
        Unload add_angajati
        Exit Sub
    
    ERRHANDLER:
        MsgBox "Unexpected error in procedure: cmdOk_Click" & vbCrLf & _
        "Error #" & Err.Number & ": " & Err.Description, _
        vbCritical + vbOKOnly, App.Title
    End Sub
    Last edited by loquin; 12-21-06 at 13:16.

  6. #6
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Where does the error originate?

    add a breakpoint to your error handler, temporarily add a RESUME statement, and step through the error handler.

    Program execution will return to the statement that generated the error as you step "through" the resume statement.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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