Error during tableAdapter.update does not trigger an exception

  • Thread starter Thread starter Magnus
  • Start date Start date
M

Magnus

My situation compares to this: I have two tables parentTable(id, foreignId)
and childTable(id, value). "foreignId" in the "parentTable" references "id"
in "childTable". The constraint is by default set to "ON DELETE NO ACTION"
(using sql server 2005), which means the delete fails if there are related
records in the childTable.

My main problem is that when I use the datatable.Remove() method and later
execute the tableadapter.update() method, the record isn't deleted on the
database server, however it is removed from the datatable.rows
rowcollection. There are no exception thrown when the delete command fails
for the record flagged for deletion in the tableadapter.

My question is: How can I handle this concurrency problem? In an elegant
way. I imagine the sane end result is to report about the failed delete, and
keep the record flagged for deletion in the datatable, or return the record
to the original datatable.

Thank you.

- Magnus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top