如何回滚一次调用更多的程序?

时间:2019-05-01 07:46:41

标签: vb.net

我正在调用在vb.net中多次调用的存储过程 怎么使用commit?

        Dim cmd1 As SqlCommand = New SqlCommand("Create_Line_Doc", con)
        cmd1.CommandType = CommandType.StoredProcedure
        cmd1.Transaction = sqlTransaction
        For j = 0 To 20
            Dim m = Exec2(con, j, sqlTransaction, cmd1)
            If Not m = "success" Then
                Console.WriteLine("" + i.ToString + " - " + m)
                sqlTransaction.Rollback()
                Exit Try
            End If
        Next
        sqlTransaction.Commit()

此代码仅回滚最后一个调用,我想回滚所有调用 请帮助我!

0 个答案:

没有答案