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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. DataTable Reset method

DataTable Reset method

Scheduled Pinned Locked Moved .NET (Core and Framework)
question
2 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.
  • C Offline
    C Offline
    Coding123456
    wrote on last edited by
    #1

    The MSDN documentation states that the Reset method 'Resets the DataTable to its original state' Now I may be a bit paranoid here thinking there could be a few interpretations of 'original' but here goes. Does anyone know what is classified as the 'Original State'? If the datatable contained data and then the Reset method was called. Do they mean it is the state when it was declared which has the structure of the datatable object but no data, or some other state?

    D 1 Reply Last reply
    0
    • C Coding123456

      The MSDN documentation states that the Reset method 'Resets the DataTable to its original state' Now I may be a bit paranoid here thinking there could be a few interpretations of 'original' but here goes. Does anyone know what is classified as the 'Original State'? If the datatable contained data and then the Reset method was called. Do they mean it is the state when it was declared which has the structure of the datatable object but no data, or some other state?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It's the state that the original records were in before any changes were made. It basically throws out all the changes to the dataset/datatable it's called on. So, if you have a bunch of records in a databtable, let the user makes changes, you can throw out all the changes by calling Reset. If you call the Update method on a dataadapter, it will look at all the changes that have to be made, as tracked by the datatable, and update the database with each change appropriately. Reset throws out all those changes before you can attempt to update the database.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      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