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. Database & SysAdmin
  3. Database
  4. Transaction in dotNET and SqlServer

Transaction in dotNET and SqlServer

Scheduled Pinned Locked Moved Database
questioncsharphelp
6 Posts 3 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.
  • D Offline
    D Offline
    Developer611
    wrote on last edited by
    #1

    Hi there . During transaction is began , I inserted new data in table , until I don't call commit() or rollback() functions , another processes can not access to this table. I mean, if i try to add a new data in a table with transaction and before closing transaction(commit or rollback) another process can't read that table; then a exception will occurred. what is the problem?

    DMASTER

    C 1 Reply Last reply
    0
    • D Developer611

      Hi there . During transaction is began , I inserted new data in table , until I don't call commit() or rollback() functions , another processes can not access to this table. I mean, if i try to add a new data in a table with transaction and before closing transaction(commit or rollback) another process can't read that table; then a exception will occurred. what is the problem?

      DMASTER

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Developer611 wrote:

      what is the problem?

      There is no problem. A transaction shouldn't last long enough for there to be a problem. I'm guessing the other process times out waiting for the table to become available. And while it is in use in a transaction you have made it unavailable. The solution is to make your transactions shorter.


      Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

      D 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Developer611 wrote:

        what is the problem?

        There is no problem. A transaction shouldn't last long enough for there to be a problem. I'm guessing the other process times out waiting for the table to become available. And while it is in use in a transaction you have made it unavailable. The solution is to make your transactions shorter.


        Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

        D Offline
        D Offline
        Developer611
        wrote on last edited by
        #3

        Thanks dear Colin . But how can I do this in short time . Did you have any solutions ?

        DMASTER

        C 1 Reply Last reply
        0
        • D Developer611

          Thanks dear Colin . But how can I do this in short time . Did you have any solutions ?

          DMASTER

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Developer611 wrote:

          But how can I do this in short time . Did you have any solutions ?

          What the heck are you actually doing? A transaction should start, the query(ies) run and the transaction committed or rolledback. What else are you doing in there that make it take so long?! If you start a transaction perform some queries, wait for user input, do some more queries then finally end the transaction then you have some serious redesigning to do.


          Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

          S 1 Reply Last reply
          0
          • C Colin Angus Mackay

            Developer611 wrote:

            But how can I do this in short time . Did you have any solutions ?

            What the heck are you actually doing? A transaction should start, the query(ies) run and the transaction committed or rolledback. What else are you doing in there that make it take so long?! If you start a transaction perform some queries, wait for user input, do some more queries then finally end the transaction then you have some serious redesigning to do.


            Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

            S Offline
            S Offline
            SalarSoft
            wrote on last edited by
            #5

            I have 5 or more queries that run in same time and one of queries take along time to done. I have to do all of this queries in a transaction. I have no way to do this in separate transactions. I think transactions work with temporary tables that mean changes will apply to original tables after commit. This means that we can use original tables while a transaction is running!?!:confused:

            C 1 Reply Last reply
            0
            • S SalarSoft

              I have 5 or more queries that run in same time and one of queries take along time to done. I have to do all of this queries in a transaction. I have no way to do this in separate transactions. I think transactions work with temporary tables that mean changes will apply to original tables after commit. This means that we can use original tables while a transaction is running!?!:confused:

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              SalarSoft wrote:

              I think transactions work with temporary tables that mean changes will apply to original tables after commit. This means that we can use original tables while a transaction is running!?!

              No. If you in a transaction and you alter a table you are altering that actual table. No temporary tables are involved unless you explicitly involve them. Changes are made as you make them. If you roll back the changes are reversed.

              SalarSoft wrote:

              I have 5 or more queries that run in same time and one of queries take along time to done.

              If you are using SQL Server 2005 you may like to look into Snapshot transactions. That might help you.


              Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... "I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless." My website

              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