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. DataAdapter and DBConcurrencyException

DataAdapter and DBConcurrencyException

Scheduled Pinned Locked Moved C#
helpcsssharepointdatabasejson
2 Posts 1 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.
  • M Offline
    M Offline
    mark_w_
    wrote on last edited by
    #1

    I am trying to put together a quick and dirty app, but have hit a problem and need a litle help!! basically i have a DataAdpter and fill a datatable. This is then bound to a grid, and the user can edit the data (not add or delete records tho) Easy so far! Then they can click save and i call _adapter.Update(_dataTable); now if some of the data has been changed in the database i get an DBConcurrencyException. What i really want to do is prompt the user for each record that has changed by another app in the database, and ask if they want to force their values on the record or abort that record update, and continue with the rest. Can i do this, still using the _adapter.Update method? if not, whats the easyest (sp) way to do it Many Thanks Mark

    M 1 Reply Last reply
    0
    • M mark_w_

      I am trying to put together a quick and dirty app, but have hit a problem and need a litle help!! basically i have a DataAdpter and fill a datatable. This is then bound to a grid, and the user can edit the data (not add or delete records tho) Easy so far! Then they can click save and i call _adapter.Update(_dataTable); now if some of the data has been changed in the database i get an DBConcurrencyException. What i really want to do is prompt the user for each record that has changed by another app in the database, and ask if they want to force their values on the record or abort that record update, and continue with the rest. Can i do this, still using the _adapter.Update method? if not, whats the easyest (sp) way to do it Many Thanks Mark

      M Offline
      M Offline
      mark_w_
      wrote on last edited by
      #2

      after some digging, i have found the answer adapter.ContinueUpdateOnError = true; will make sure it continues after an error and SqlCeCommandBuilder builder = new SqlCeCommandBuilder(adapter); builder.ConflictOption = ConflictOption.OverwriteChanges; Makes it a last in wins, which will do for my app.

      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