Uncommiteed SQLTransaction causing the problem
-
Hi All, I thought it would be simple solution but not really being able to crack it. I have a webservice which acts as data provider to the client which is a windows application. The webservice has various web methods and I have written them in a way that they share same SQLTransaction object while retrieving data. WebService has BeginTransaction(), CommitTransaction() and RollbackTransaction() methods. when I want to perform an operation (which typically consists of 3/4 webmethod calls) I call BeginTransaction() first and CommitTransaction() or RollbackTransaction() after the operation is finished or in case of exception. The problem: If the user makes the application to end using task manager after BeginTransaction() has been called and before CommitTransaction() or RollbackTransaction() is called. When next time the application is launched, it fails to fetch data and gets stuck attempting to retieve it. This is because the previous transaction is still locking the tables! Well, It might take long to read the post but I thought it was important to explain it in detail. Can anyone think of any way out? Thanks in Advance AD
Every bit counts
-
Hi All, I thought it would be simple solution but not really being able to crack it. I have a webservice which acts as data provider to the client which is a windows application. The webservice has various web methods and I have written them in a way that they share same SQLTransaction object while retrieving data. WebService has BeginTransaction(), CommitTransaction() and RollbackTransaction() methods. when I want to perform an operation (which typically consists of 3/4 webmethod calls) I call BeginTransaction() first and CommitTransaction() or RollbackTransaction() after the operation is finished or in case of exception. The problem: If the user makes the application to end using task manager after BeginTransaction() has been called and before CommitTransaction() or RollbackTransaction() is called. When next time the application is launched, it fails to fetch data and gets stuck attempting to retieve it. This is because the previous transaction is still locking the tables! Well, It might take long to read the post but I thought it was important to explain it in detail. Can anyone think of any way out? Thanks in Advance AD
Every bit counts
The odds of that happening are EXTREMELY Slim... It's like the "If x is saving, and I have a Power Failure, then it crashes next time it starts up." type of question. Although, maybe in your case you could have a true / false setting which decides if the transaction is in process, with a timeout. If it expires, it automatically rolls back. Just an idea :) - Reelix
-
The odds of that happening are EXTREMELY Slim... It's like the "If x is saving, and I have a Power Failure, then it crashes next time it starts up." type of question. Although, maybe in your case you could have a true / false setting which decides if the transaction is in process, with a timeout. If it expires, it automatically rolls back. Just an idea :) - Reelix
Thanks for reply. The problem is I dont have anything to check even if I use true/false. The application has been closed and it doesnt even know that it is being closed down. I dont get any event when the application is closed using task manager. AD
Every bit counts