首页 > 代码库 > 事务提交

事务提交

‘添加事务提交 Dim con As SqlConnection = New SqlConnection(frmSetting._DatabaseProvider.GetConnectionString) Dim cmd As SqlCommand = New SqlCommand() Dim tran As SqlTransaction con.Open() tran = con.BeginTransaction() cmd.Connection = con cmd.Transaction = tran Try cmd.CommandText = tmpSQL cmd.ExecuteNonQuery() tran.Commit() con.Close() Catch ex As Exception tran.Rollback() con.Close() End Try 

 

事务提交