Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Catch 22
Message
From
10/09/2013 15:39:49
 
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01581904
Message ID:
01582765
Views:
43
>David suggested this code
>
>
>sqlConnection.EnlistTransaction(Transaction.Current);
>
>which worked after I introduced a new property and disabled check for uncommitted transactions (when this new property is set to true) and explicit committing of them which we were doing in each SQL call.


Ah ... I didn't think of that. With the normal use of TransactionScope (wrapping all database access, which eliminates the need for SqlTransaction use totally), that wouldn't be necessary because the TransactionScopeOption.Required automatically enlists the transaction in any existing current transaction. Sometimes you don't want to do that, however, and the way to prevent automatic enlistment is to use the TransactionScopeOption.RequiresNew ... then the scope will be "self-contained" (for lack of a better word).

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform