locked
Updating multiple related tables via UpdateDataset? RRS feed

  • Question

  • User83346904 posted
    Am I missing something, or is it not really possible to use UpdateDataset() with a dataset that includes multiple tables with relational integrity requirements between them?  Since UpdateDataset() evidently performs all of the inserts, updates and deletes for a single table at the time it is called, how can it possible reconcile both deletions and insertions using multiple calls to UpdateDataset(), one for each table in the dataset, without violating database constraints (on child records needing to have parents, for example) in at least some cases?  Out of desperation, I've tried virtually every possible combination of settings for relational integrity (cascading vs. not) in the dataset and every order for the multiple calls to UpdateDataset() (since it only operates on one table per call) ... and in every case one of the database stored procs at some point complains that they are either being asked to delete nonexistent records or else leave records orphaned.  And I've yet to find any example of UpdateDataset() being used other than on a dataset with a single flat table, which suggests to me that it may not be intended for use in more complex database update scenarios.

    What do you experienced DAAB developers do when you need to update a hierarchy of related tables from a single dataset?  If you don't use UpdateDataset(), what do you use instead?  Do I need to go outside of the DAAB and back to pure ADO.NET to accomplish this type of thing?

    (I'm using the GotDotNet DAAB rather than Enterprise Library for this, by the way (scheduling requirements), with Oracle as the underlying database engine, in case that makes any difference.)

    Thanks for any advice that helps clarify how (or if) this sort of thing is supposed to work within the confines of the DAAB.
    Sunday, May 22, 2005 11:47 AM

All replies

  • User83346904 posted

    In case anyone would like to know, I worked around this problem by massaging the dataset of changes to remove any child records whose parent was also deleted before I submit it to UpdateDataset().  It still surprises me a bit that such an approach would be required ... I'd have expected the DAAB to have provided some level of built-in support for what seems like a relatively common operation.

    Wednesday, May 25, 2005 11:34 AM