Home All Groups Group Topic Archive Search About

DataSet foreign key update problem

Author
6 Apr 2006 3:13 PM
Jamie Oglethorpe
I have a strongly typed DataSet with a bunch of tables and relationships. The
relationships reflect the foreign key relationships in the underlying
database.

One of the tables is a join table, linking the others; all of them represent
one logical entity.

When I create new rows in these tables, I set the keys on the records to
negative values, so that I can represent the relationships correctly. I then
use UpdateDataSet to insert the foreign tables, and finally the join table.
As each is inserted, the identity value from the database is correctly set in
the table being added, and in the join table.

Unfortunately the RowState of the join table becomes Unchanged as the other
records are inserted, hence it is not written to the database.

I think this is a bug in .Net 2.0. I can think of many ugly ways around the
problem, but can anybody think of something elegant?

AddThis Social Bookmark Button