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. General Programming
  3. C#
  4. Managing database deletions?

Managing database deletions?

Scheduled Pinned Locked Moved C#
csharpdatabasevisual-studiohelpquestion
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.
  • K Offline
    K Offline
    kbalias
    wrote on last edited by
    #1

    I hope I can explain the problem clear enough. I am loading data from my database into a DataSet and then display the data in a ListView. The user can then select one or more of the records in the ListView for deletion and the click the Delete button. After the Update method of the DataAdapter was called, I would like the records that were successfully deleted, to be removed from the ListView, but the records that could not be deleted (for whatever reason: Concurrence problems, has child records, etc) to be highlighted in the ListView. The user can then click on a Report button to see what the reason was for each of the delete errors. Is this possible? How can this be achieved? I am using Visual Studio 2003 and C#. Thanks. Kobus

    I 1 Reply Last reply
    0
    • K kbalias

      I hope I can explain the problem clear enough. I am loading data from my database into a DataSet and then display the data in a ListView. The user can then select one or more of the records in the ListView for deletion and the click the Delete button. After the Update method of the DataAdapter was called, I would like the records that were successfully deleted, to be removed from the ListView, but the records that could not be deleted (for whatever reason: Concurrence problems, has child records, etc) to be highlighted in the ListView. The user can then click on a Report button to see what the reason was for each of the delete errors. Is this possible? How can this be achieved? I am using Visual Studio 2003 and C#. Thanks. Kobus

      I Offline
      I Offline
      ic3b3rg3
      wrote on last edited by
      #2

      First you have to save the records to be deleted for later highlighting them. Save them to a dataset or whatever you find yourself comfortable with. Then when deleting the rows use try catch error handling. I hope you know how to use try catch stuff. Whatever. Then in the catch part if there are any errors you can your saved datas there and highlight the previously them.

      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