---
title: "Bill Vaughn blogs, and I ask an ADO.Net question"
url: "https://osherove.com/blog/2004/4/29/bill-vaughn-blogs-and-i-ask-an-adonet-question.md"
canonical: "https://osherove.com/blog/2004/4/29/bill-vaughn-blogs-and-i-ask-an-adonet-question.html"
published: "2004-04-29T19:52:00"
updated: "2004-04-29T19:52:00"
tags: [".Net Original"]
author: "Roy Osherove"
description: "Bill Vaughn started a blog over at DotNetJunkies . Coolness! I've been reading an hearing some of Bill's thoughts on Data Access in the recent past and all I can say is that I wish I knew all the stuff he's already…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Bill Vaughn blogs, and I ask an ADO.Net question

By Roy Osherove April 29, 2004 In [.Net Original](https://osherove.com/blog/category/net-original)

**Historical article** · Originally published April 29, 2004; technical details may be outdated.

 [Bill Vaughn started a blog over at DotNetJunkies](http://dotnetjunkies.com/WebLog/hitchhiking/archive/2004/04/29/12408.aspx). Coolness!

I've been reading an hearing some of Bill's thoughts on Data Access in the recent past and all I can say is that I wish I knew all the stuff he's already forgotten about ADO.Net and Data Access techniques in general. [Subscribed](http://dotnetjunkies.com/WebLog/hitchhiking/Rss.aspx).

Now, here's something for Bill to gnaw on, since he specifically said 

_“I've been known to answer questions when I can and I try not to make up the answer when I can't...”_ 

**Context:**

- You have a Dataset that contains one parent table and one child table (with a relation between them).
- The Parent table has a primary key comprising of Identity Values that needs to be reconciled with the database.
- The Relation between the two tables is declared as “Cascade Update” and “Cascade Delete”.
- You have a new row in the parent table and some new child rows for that row in the child table that you need to add to the database.
- To save bandwidth, you use the GetChanges() method of the dataset and update those values.
- The update succeeds and also retrieves back the new identity value of the new row (following all the steps mentioned in [this MSDN article](http://msdn.microsoft.com/msdnmag/issues/04/05/DataPoints/default.aspx))
- Identity columns are set to -1 with an increment of -1 to prevent database collisions

**Problem:**

Trying to merge the changed dataset with the original produces a ContraintException due to some sort of problem with the child rows in the child table(even though Cascade update is set to true). This problem does not occur if there are no new child rows to be updated as well.

**Possible Solutions?**

- [This article](http://devcenter.infragistics.com/Articles/ArticleTemplate.Aspx?ArticleID=2147) seems like a possible way to resolve this. What do you think?
- I've heard on one of the recent .Net Rocks shows that Bill suggested approaching this problem by actually creating some empty rows on the database first instead of creating them in memory, thus preventing an constraint conflicts. However, it was mentioned as an afterthought to the conversation and I'm not sure that's the most elegant solution here.
- _\[Added later\]_ Here's [Bill's article on this issue](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/manidcrisis.asp). I'll read it and see how it fits the problem.
- _\[Added later\]_  Bill has many other cool and useful [articles on his website](http://www.betav.com/). I'll have a look see when I get some time this weekend.

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Apr 29, 2004

    ### [Why is VS.Net Add-in architecture so overly complicated?](https://osherove.com/blog/2004/4/29/why-is-vsnet-add-in-architecture-so-overly-complicated.html)

- Apr 29, 2004

    ### [How to: Creating project groups under a single solution](https://osherove.com/blog/2004/4/29/how-to-creating-project-groups-under-a-single-solution.html)

- Apr 25, 2004

    ### [1st prize just got a whole lot bigger](https://osherove.com/blog/2004/4/25/1st-prize-just-got-a-whole-lot-bigger.html)

- Apr 25, 2004

    ### [Test Driven Development Workshop is a go!](https://osherove.com/blog/2004/4/25/test-driven-development-workshop-is-a-go.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
