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. Trouble removing deleted rows...

Trouble removing deleted rows...

Scheduled Pinned Locked Moved Database
databasequestionannouncement
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.
  • J Offline
    J Offline
    james cxx
    wrote on last edited by
    #1

    I have a DataSet that is filled by a SqlDataAdapter. If a row is deleted within the app, this is properly reflected in both the DataSet and central database when Update() is called on the SqlDataAdapter. However, if records are deleted from the database by some other process (outside the application), and I subsequently call the Fill(dataset.table) method of the SqlDataAdapter, the rows that were deleted from the database still seem to exist in the DataSet. Any ideas how I can ensure that if records have been deleted from the database, that these deletions are fully reflected in the DataSet? -- James --

    R 1 Reply Last reply
    0
    • J james cxx

      I have a DataSet that is filled by a SqlDataAdapter. If a row is deleted within the app, this is properly reflected in both the DataSet and central database when Update() is called on the SqlDataAdapter. However, if records are deleted from the database by some other process (outside the application), and I subsequently call the Fill(dataset.table) method of the SqlDataAdapter, the rows that were deleted from the database still seem to exist in the DataSet. Any ideas how I can ensure that if records have been deleted from the database, that these deletions are fully reflected in the DataSet? -- James --

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

      The deleted rows are likely only visible in the deleted rows view (Datatable retains all your original rows unless you clear it first, or call datatable.acceptchanges after you call Fill to "refresh" the data. Same applies to modifications made by others. Strange behavior perhaps, but that how it's documented. Genius may have its limitations, but stupidity is not thus handicapped. - Elbert Hubbard

      J 1 Reply Last reply
      0
      • R Rob Graham

        The deleted rows are likely only visible in the deleted rows view (Datatable retains all your original rows unless you clear it first, or call datatable.acceptchanges after you call Fill to "refresh" the data. Same applies to modifications made by others. Strange behavior perhaps, but that how it's documented. Genius may have its limitations, but stupidity is not thus handicapped. - Elbert Hubbard

        J Offline
        J Offline
        james cxx
        wrote on last edited by
        #3

        Calling AcceptChanges on the datatable after the Fill did not seem to remove the extra records. However, calling Clear on the table just before calling Fill does the trick. I was a little wary of using Clear for fear of deleting my database, but I see it only clears the table and doesn't mark records for deletion. Thanks for the help! -- James --

        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