DAAB 3.0 & TransactionScope

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top