Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Rows and Constraints
Message
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00819978
Message ID:
00820335
Vues:
17
>Hi Rick,
>
>What are the data manipulations that made you want to change your approach?
>

I was having some problems <g>...

The idea is that the bus object should be able to be fully self-contained on the client once created so detail items etc. can be housed in a DataSet as a DataTable. The problem before was that I would create new items but not add them to the row collection until Save() was called. This works fine for saving, but not for any code that iterates over the detail collection of rows. So, as I was adding detail items I was getting invalid values for things like totalling that run over the individual rows to do their calculation because the new rows hadn't been added to the table yet. Once i save they're there, but not until then. So...

My current fix is to have GetBlankRecord() not add the row, but when I do New() (which calls GetBlankRecord()) then I do add it. By the time New() is called the PK at least is taken care of which has been my primary issue. But it may still cause further problems with rule violations if other fields have issues such as NULL or constraint issues that are not automatically handled by New(). At least in New() I have the ability to subclass and override those values as needed and set to defaults that will allow to add, which is actually not a bad idea as a basic place in the bus object to handle those kind of assignments.

I've really struggled with this issue, because of the lack of ability to get this sort of thing directly down from the database. The database generally has default values definied but DataRows do not get fed this data. So now we're duplicating functionality. THe only other alternative is to let the database gen the data and pass it back but that results in a lot of wasted PKs and requirets full connectivity.

Still not set with this, but for this current app I'm working on this approach works. It just feels like hack which it is...
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform