Click here to Skip to main content
16,009,255 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I My VB.net application , saving function an error occurred when

transaction = roConform.BeginTransaction()

Error:
New transaction is not allowed because there are other threads running in the session

Code::
Private Sub tolSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tolSave.Click
        Call SaveData()
 End Sub

 Private Sub SaveData()
        Dim dsLogin As DataSet
        Dim amount As Double
        Dim credit As Boolean        
        Try
            If (UserPower = 1) Then
                If SaveFlag = False Then

                    transaction = roConform.BeginTransaction()
                    dsLogin = clsBrand.AddMember(roConform, transaction, 1, 0, txtSerialNo.Text, Format(dtpAdmitDate.Value, "dd/MMM/yyyy"), txtAngamNo.Text, txtName.Text, txtSirname.Text, txtHouse.Text, txtPlace.Text, txtaddress.Text, txtpostoffice.Text, cmbdistrict.Text, amount, credit, txtRemarks.Text, cmbunit.Text, txtph.Text, txtmob.Text, txtnameeng.Text)
                    transaction.Commit()
                    MsgBox("Successfully Saved !")
                ElseIf SaveFlag = True Then
                    transaction = roConform.BeginTransaction()
                    dsLogin = clsBrand.AddMember(roConform, transaction, 2, rowid, txtSerialNo.Text, Format(dtpAdmitDate.Value, "dd/MMM/yyyy"), txtAngamNo.Text, txtName.Text, txtSirname.Text, txtHouse.Text, txtPlace.Text, txtaddress.Text, txtpostoffice.Text, cmbdistrict.Text, amount, credit, txtRemarks.Text, cmbunit.Text, txtph.Text, txtmob.Text, txtnameeng.Text)
                    transaction.Commit()
                    MsgBox("Successfully Updated !")
                End If
            End If        
        Catch ex As Exception
            transaction.Rollback()
            MsgBox(ex.Message)
        End Try
    End Sub



How to resolve it
Posted
Updated 29-Jun-11 23:14pm
v3
Comments
[no name] 30-Jun-11 4:54am    
put your code.. What you are doing exactly

Read the error message. Think about what it means. Think what it's asking you to do. You have other threads running, and for some reason that's not OK. Best way to find a solution, put the error message in quotes and google it.
 
Share this answer
 
Comments
vipinsethumadhavan 30-Jun-11 5:11am    
I got Solution , that is before begintransaction(), I just
roconfm.close()
clsdb.opendb(roconfm)
----
Then no problem , it works fine. But Each save time it will close and open db working ,
I did google this issue and I found your solution Christian. Thanks!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900