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