本文介绍了不允许新交易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的VB.net应用程序,保存功能时发生错误
transaction = roConform.BeginTransaction()
错误:
不允许新事务,因为会话中还有其他线程运行
Code ::
Private Sub tolSave_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理tolSave.Click
调用SaveData()
End Sub
Private Sub SaveData()
Dim dsLogin As DataSet
Dim amount As Double
Dim credit As Boolean
Try
If(UserPower = 1)那么
如果SaveFlag = False那么
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,txtP lace.Text,txtaddress.Text,txtpostoffice.Text,cmbdistrict.Text,amount,credit,txtRemarks.Text,cmbunit.Text,txtph.Text,txtmob.Text,txtnameeng.Text)
transaction.Commit()
MsgBox(成功保存!)
ElseIf SaveFlag = True然后
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如果
结束如果
Catch ex As Exception
transaction.Rollback()
MsgBox(ex.Message)
结束尝试
结束子
如何解决它
解决方案
这篇关于不允许新交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!