Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Uncommiteed SQLTransaction causing the problem

Uncommiteed SQLTransaction causing the problem

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    atuldeore
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • A atuldeore

      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

      R Offline
      R Offline
      Reelix
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • R 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

        A Offline
        A Offline
        atuldeore
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups