transactionscope

Is there a way to use TransactionScope with an existing connection?

I have some code that works like the advised use of TransactionScope, but has an ambient connection instead of an ambient transaction. Is there a way to use a TransactionScope object with an existing connection, or is there an alternative in the .Net framework for this purpose? ...

Using TransactionScope with MySQL and Read Lock

I have the following situation: If have a MySQL db with a InnoDB table which I use to store unique numbers. I start a transaction, read the value (eg. 1000471), store this value in another table and update the incremented value (100472). Now I want to avoid that somebody else even reads the value while my transaction is running. If I w...

How to know if the code is inside TransactionScope?

What is the best way to know if the code block is inside TransactionScope? Is Transaction.Current a realiable way to do it or there are any subtleties? Is it possible to access internal ContextData.CurrentData.CurrentScope (in System.Transactions) with reflection? If yes, how? Thank you in advance. ...

TransactionInDoubtException using System.Transactions on SQL Server 2005

The underlying question to this post is "Why would a non-promoted LTM Transaction ever be in doubt?" I'm getting System.Transactions.TransactionInDoubtException and i can't explain why. Unfortunately i cannot reproduce this issue but according to trace files it does happen. I am using SQL 2005, connecting to one database and using one ...

Why does the following SQL Server insert deadlock when run within a transaction?

I'm currently inserting a record into a SQL Server Table and then selecting the auto-increment ID as follows: (@p0 int,@p1 nvarchar(8))INSERT INTO [dbo].[Tag]([Some_Int], [Tag]) VALUES (@p0, @p1) SELECT CONVERT(Int,SCOPE_IDENTITY()) AS [value] (This was generated using Linq-to-SQL). For some reason when I run this code inside a trans...

Using TransactionScope with typed dataset

I have a WinForm application querying SqlCe database using typed-dataset tabledapters. I have a main form assembly and a database assembly which handles every db operation. I'm having problems with updating using tableadapter in a transaction and I'd appreciate if anyone could give me any ideas why. Update() method gives this error: "...

Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.

Just curious if anyone else has got this particular error and know how to solve it? The scenario is as follow... We have an ASP.NET web application using Enterprise Library running on Windows Server 2008 IIS farm connecting to a SQL Server 2008 cluster back end. MSDTC is turned on. DB connections are pooled. My suspicion is that some...

TransactionScope and rolling back object state

I'm looking for a solution to a design problem. This will take a bit of explaining. I would post code, but that woul make this even longer. I have a custom generic collection I use to hold Business Objects as needed. For easy of reference, call the business objects BO and the generic collection GC. Inside GC I have a private colle...

.NET TransactionScope on Oracle

Hello, we are using DAAB and TransactionScope on Oracle. Our application manage all the connection to only 1 database. This type of implementation it seems to need "Oramts.dll". Is there a way of using your DAAB and TrasnsactionScope without MTS? Thanks! ...

TransactionScope: Has it gotten better?

When TransactionScope first came out, I ran into some serious issues getting it to work between my dev machine (XP) and our database server (Windows Server 2003). When I looked into it more, this appeared to be a tricky and widespread issue that had a chance of becoming a headache in production, so I decided not to handle transactions t...

Is there a way to create an ADO.NET connection and ignore the ambient Transaction?

I have a situation where I am running in a WCF service that has TransactionScopeRequired=true, which means there will always be an ambient transaction. However, I need to start a new connection that will be around for the lifetime of the application, which means I can't have it use the abmbient transaction. Any ideas on how to do this?...

NHibernate first level cache and Transaction Management between TransactionScope and NHibernate ITransaction

My development group is about to release a version of an internal framework that uses NHibernate (and Spring.NET) for persistence. Developers currently using our internal framework use ADO.NET for persistence, so going forward they will use a combination of ADO.NET and NHibernate. During testing of the NHibernate, we found out that the N...

subsonic 3 - The operation is not valid for the state of the transaction.

Hi I'm trying the following code UserDetail ud = UserDetail.SingleOrDefault(u => u.UserName == CurrentUserName); if (ud == null) ud = new UserDetail(); Address uAddress = ud.AddressId.HasValue ? Address.SingleOrNew(a => a.Id == ud.AddressId) : new Address(); using (TransactionScope tc = ...

How can I implement a class that is aware of TransactionScope?

I have a WCF service that is performing some updates across a couple of databases and Active Directory. Since Active Directory is not able to support transactions, I want to implement then in a "DirectoryRepository" class that will perform a compensating action when a rollback occurs. my code is using TransactionScope... using(var scop...

How to handle nested datacontext in the BL?

public class TestBL { public static void AddFolder(string folderName) { using (var ts = new TransactionScope()) { using (var dc = new TestDataContext()) { var folder = new Folder { FolderName = folderName }; dc.Folders.InsertOnSubmit(folder); ...

How to define Transaction Timeout during debugging application.

I am testing whether option from app.config listed below Is applied to all transactions in the application. <system.transactions> <defaultSettings timeout="00:05:00" /> </system.transactions> Transaction are defined using transaction scope in following way using (TransactionScope transactionScope = new TransactionScope(Transactio...

TransactionScope won't work with DB2 provider

Hi Everyone, I've been trying to use TransactionScope with a DB2 database (using DB2 .Net provider v 9.0.0.2 and c# 2.0) which SHOULD be supported according to IBM. I have tried all the advice i could find on the IBM forums (such as here) to no avail. I have enabled XA transactions on my XP Sp2 machine, tried also from a Win 2003 Serv...

Related insert fails in transationscope

I am using TransactionScope to add a object's data to one database. pseudo code: using (TransactionScope trx = new TransactionScope()) { SqlConnection con = DL.GetNewConn(); int newParentRecordID = InsertParentIntoTableA(object parent, con); foreach(obj child in parent.childrenObjects) { child.ParentID = newParentRe...

How to use transactions in DotNetNuke (entangled with L2S)?

I use L2S at my module. The problem occurs while I'm using the default DNN entities at the same TransactionScope with my L2S data access, then I get a DTC request which I want to avoid. How can I share the connection/transaction for both DNN entities and my L2S data access? ...

Error Binding Gridview: "The current TransactionScope is already complete"

I am doing cascading deletes in an event sent from a Gridview. The deletes are in a Transaction. Here is the simplified code: protected void btnDeleteUser_Click(object sender, EventArgs e) { DataContext db; db = new DataContext(); using (TransactionScope ts = new TransactionScope()) { try { /...