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. Is datatable.update necessary

Is datatable.update necessary

Scheduled Pinned Locked Moved Database
questiondatabaseannouncement
5 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.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    Hi, This is closely related to my previous question BUT ... I go through a web log file and extract each line and put the data into a new row in a datatable. I then change the data in one field of each row. I then use that datatable as my source for extracting various statistics. At no time do I really need to save the datatable to the underlying database as far as I can see. If I don't need to save the datatable to the database, do I really need to do a datatable.update let alone a dataset.acceptchanges?

    Glen Harvy

    P 1 Reply Last reply
    0
    • G Glen Harvy 0

      Hi, This is closely related to my previous question BUT ... I go through a web log file and extract each line and put the data into a new row in a datatable. I then change the data in one field of each row. I then use that datatable as my source for extracting various statistics. At no time do I really need to save the datatable to the underlying database as far as I can see. If I don't need to save the datatable to the database, do I really need to do a datatable.update let alone a dataset.acceptchanges?

      Glen Harvy

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      If you only need to use the DataTable object as an in-memory repository for data, then you don't need to use these methods. They are used for synchronising the contents of the DataTable with an underlying database. Paul

      G 1 Reply Last reply
      0
      • P pmarfleet

        If you only need to use the DataTable object as an in-memory repository for data, then you don't need to use these methods. They are used for synchronising the contents of the DataTable with an underlying database. Paul

        G Offline
        G Offline
        Glen Harvy 0
        wrote on last edited by
        #3

        Thanks for that - it's funny how I have never stopped to think about what I was doing until performance became an issue. Suppose this is often the case now that I think about it. Just one thing more though... Is there any need at all to call dataset.acceptchanges() if you have just done a datatable.update and you know there hasn't been any other changes to the datatset. Logically the answer is no but I just want to confirm that. Thanks for your time.

        Glen Harvy

        P 1 Reply Last reply
        0
        • G Glen Harvy 0

          Thanks for that - it's funny how I have never stopped to think about what I was doing until performance became an issue. Suppose this is often the case now that I think about it. Just one thing more though... Is there any need at all to call dataset.acceptchanges() if you have just done a datatable.update and you know there hasn't been any other changes to the datatset. Logically the answer is no but I just want to confirm that. Thanks for your time.

          Glen Harvy

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          I don't do this kind of stuff with DataTables very often, but according to the MSDN documentation... When AcceptChanges is called, any DataRow object still in edit mode successfully ends its edits. The DataRowState also changes: all Added and Modified rows become Unchanged, and Deleted rows are removed. So I think you should call AcceptChanges after Update to reset the status of the rows in your DataTable. Paul

          G 1 Reply Last reply
          0
          • P pmarfleet

            I don't do this kind of stuff with DataTables very often, but according to the MSDN documentation... When AcceptChanges is called, any DataRow object still in edit mode successfully ends its edits. The DataRowState also changes: all Added and Modified rows become Unchanged, and Deleted rows are removed. So I think you should call AcceptChanges after Update to reset the status of the rows in your DataTable. Paul

            G Offline
            G Offline
            Glen Harvy 0
            wrote on last edited by
            #5

            Yep - I agree with you. Thanks.

            Glen Harvy

            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