G
Guest
Hi,
I can't seem to get these two to work together. I have a stored procedure
that deletes rows from a table but I can't get it to rollback; any help would
be appreciated. This is the code I have:
Using ts As New TransactionScope(TransactionScopeOption.RequiresNew)
Dim db As Database = DatabaseFactory.CreateDatabase
Dim dbCommand As DbCommand = db.GetStoredProcCommand("sp")
For i As Integer = 0 To usernames.Length() - 1
For j As Integer = 0 To roleNames.Length() - 1
dbCommand.Parameters.Clear()
' Add parameters here
If j > 1 Then
Throw New ApplicationException("Planned Exception")
End If
db.ExecuteNonQuery(dbCommand)
Next
Next
ts.Complete()
End Using
I can't seem to get these two to work together. I have a stored procedure
that deletes rows from a table but I can't get it to rollback; any help would
be appreciated. This is the code I have:
Using ts As New TransactionScope(TransactionScopeOption.RequiresNew)
Dim db As Database = DatabaseFactory.CreateDatabase
Dim dbCommand As DbCommand = db.GetStoredProcCommand("sp")
For i As Integer = 0 To usernames.Length() - 1
For j As Integer = 0 To roleNames.Length() - 1
dbCommand.Parameters.Clear()
' Add parameters here
If j > 1 Then
Throw New ApplicationException("Planned Exception")
End If
db.ExecuteNonQuery(dbCommand)
Next
Next
ts.Complete()
End Using