November 2005 Blog Posts
My TypedDataSet has the wrong identity key values

When working with typed datasets that have parent/child relationships, and using SqlDataAdapters with SqlCommandBuilders to load and update data back to your data source, you may run into foreign key constraint issues.

Why?  Well, suppose you are populating a datagrid with your typed dataset.  You add a parent row, and then add a child to that row.  You haven't yet tried to push your updates again.  Since the datagrid isn't connected to the database, it autogenerates the ID values it uses to populate the rows. 

When you go to push your updates back to the database, it won't try to publish the ID values for the identity columns.  But the ID that is in the child row will be the datagrid generated value, and, unless you are damn lucky, the datagrid generated value won't match the value that is generated by the database on the insert.

So how to fix this?  Two things to do:

1) In the definition of your typed dataset, make sure you choose to cascade your relationships.

2) Use this code: SqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey

That line of code tells the SqlDataAdapter that it needs to pull back the real ID value, and since cascade is turned on, it will cascade through the dataset and so through the datagrid.

posted @ Thursday, November 17, 2005 3:13 PM | Feedback (0)
Does Visual Studio Rot the Mind?

Interesting article.  Can't say I agree with a lot of it, but it reminds me of people I've worked with:

posted @ Wednesday, November 16, 2005 11:52 AM | Feedback (0)
Visual Studio 2005 Web Deployment Projects

posted @ Monday, November 07, 2005 10:39 AM | Feedback (0)
Using IIS with Visual Studio 2005

A good overview:

posted @ Monday, November 07, 2005 10:34 AM | Feedback (0)
DW and BI overview site

Another general site that describes the basics:

posted @ Tuesday, November 01, 2005 12:35 PM | Feedback (0)
.NET: OR mapping tools

Provides a list of what's out there.  Comprehensive and currently up-to-date:

Here's another:

posted @ Tuesday, November 01, 2005 9:54 AM | Feedback (0)
Datawarehousing basics in a nutshell

Very clear and succinct:

posted @ Tuesday, November 01, 2005 9:37 AM | Feedback (1)