开发者

Transactions and Rollback for Typed DataSets in VB.NET

开发者 https://www.devze.com 2023-03-25 18:03 出处:网络
How do I include the typed dataset in my transaction so that I can rollback when I catch an error? Is there a way where I can commit both the typed and untyped dataset?

How do I include the typed dataset in my transaction so that I can rollback when I catch an error? Is there a way where I can commit both the typed and untyped dataset?

          myTransaction = calConnect.Connection.BeginTransaction("myRollback")

         Try
            CommandInsertCE.Transaction = myTransaction

            CommandInsertCE.ExecuteNonQuery()
            myTransaction.Commit()

            dgvwCalibRes.DataSource = CalibrationDataSet.Tables("Calib开发者_如何学CrationTrials")
            taCalTrials.Update(Me.CalibrationDataSet.CalibrationTrials)

        Catch ex As Exception
            myTransaction.Rollback("myRollback")

        End Try
0

精彩评论

暂无评论...
验证码 换一张
取 消