471,086 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,086 software developers and data experts.

DAAB 3.0 & TransactionScope

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.RequiresNe w)
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
May 11 '07 #1
1 1233
Has anyone else run across this problem?

"JJ" wrote:
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.RequiresNe w)
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
Jun 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by veera sekhar kota | last post: by
reply views Thread by veera sekhar kota | last post: by
reply views Thread by veera sekhar kota | last post: by
6 posts views Thread by Mukesh | last post: by
3 posts views Thread by kikapu | last post: by
reply views Thread by RP | last post: by
3 posts views Thread by Aleksey Timonin | last post: by
2 posts views Thread by GaryDean | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.