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. question on using transaction

question on using transaction

Scheduled Pinned Locked Moved Database
questiondatabase
5 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.
  • P Offline
    P Offline
    ppp001
    wrote on last edited by
    #1

    Hi, I am writing a window desktop application which only allow single user. Then is it necessary to have transaction management for the data writing to the relational database ? The data writing operation includes several steps (ie. if the window hangs, then the operation may be corrupted). Thanks

    S 1 Reply Last reply
    0
    • P ppp001

      Hi, I am writing a window desktop application which only allow single user. Then is it necessary to have transaction management for the data writing to the relational database ? The data writing operation includes several steps (ie. if the window hangs, then the operation may be corrupted). Thanks

      S Offline
      S Offline
      Selahattin Bostanci
      wrote on last edited by
      #2

      sure necessary especially if your writing operation has several steps. think about if you get an error while inserting or deleting a record related to several tables. there would sure remain some unnecessary data in tables. (records that have been deleted or inserted before getting the error.)

      P 1 Reply Last reply
      0
      • S Selahattin Bostanci

        sure necessary especially if your writing operation has several steps. think about if you get an error while inserting or deleting a record related to several tables. there would sure remain some unnecessary data in tables. (records that have been deleted or inserted before getting the error.)

        P Offline
        P Offline
        ppp001
        wrote on last edited by
        #3

        Thanks for your reply. But my program is not for enterprise application, just for desktop single user. Is this still necessary coz the addition of transaction into my program will cause a lot of effort ? So are application like MSWord,...also adopts transactions ?

        S R 2 Replies Last reply
        0
        • P ppp001

          Thanks for your reply. But my program is not for enterprise application, just for desktop single user. Is this still necessary coz the addition of transaction into my program will cause a lot of effort ? So are application like MSWord,...also adopts transactions ?

          S Offline
          S Offline
          Selahattin Bostanci
          wrote on last edited by
          #4

          its up to you but if i were you i would use transaction. (depending uopn your words about the writing process) anonymous wrote: So are application like MSWord,...also adopts transactions ? can you be more clear?

          1 Reply Last reply
          0
          • P ppp001

            Thanks for your reply. But my program is not for enterprise application, just for desktop single user. Is this still necessary coz the addition of transaction into my program will cause a lot of effort ? So are application like MSWord,...also adopts transactions ?

            R Offline
            R Offline
            Rob Graham
            wrote on last edited by
            #5

            MSWord is not a database, so it neither supports not needs transactions. If you are making multiple related changes to multiple taples (for example: insert new row in main table, insert new row(s) in detail table using foreign key from new row in main table) you should always enclose these in a single transaction, so that if one of the dependant changes fails (an unexpected null value, an out of range value, etc. ) you can easily cancel the preceding changes (rollback the transaction). Adding the transaction support is relatively easy, and should not take much code, Transactions really have nothing to do specifically with multi-user scenarios, instead the have to do with keeping changes consistent - preventing partial updates that could corrupt the data. Absolute faith corrupts as absolutely as absolute power Eric Hoffer The opposite of the religious fanatic is not the fanatical atheist but the gentle cynic who cares not whether there is a god or not. Eric Hoffer

            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