Hi Flomo,
Thanks for Cor and Earl's suggestion.
[quoted text, click to view] >I have two tables in a strongly typed dataset, parent and child. I have
defined
>the delete rule of the relationship to cascade in both the dataset and in
the
>database.
I think the root cause is the delete rule in your database.
When you update the parent table
(parentTableAdapter.Update(aDataSet.ParentTable)), the related rows in the
child table will also be deleted by the delete rule (in database)
automatically. So that, you will receive the concurrency violation said
"non rows to delete" if you update the child table
(childTableAdapter.Update(aDataSet.ChildTable)).
[quoted text, click to view] >I then walked through the datatable rows, executing RejectChanges on those
rows
>which had a DataRowState of Deleted, but this broke the foreign key
constraint
>between the parent and child tables when calling the Update method on the
table
>adapter.
You can switch the "EnforceConstraints" property of dataset to avoid
"Foreign key constratint" issue.
aDataSet. EnforceConstraints=false;
However, I'm afraid it is not a good solution in your case. I would like to
suggest you update parent-child tables from bottom to top. You can update
the child table first and then update the parent table.
_childTableAdapter.Update(aDataSet.ChildTable)
_parentTableAdapter.Update(aDataSet.ParentTable)
This should work on your side. If you still meet any further issue on this,
please don't hesitate to let me know. I'm glad to assist you.
Have a great day.
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.