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:
00820550
Vues:
18
>The problem is that if you do this with a PK value the Row knows that it's a PK. If you add two records this way you have a PK rule violation because it's not unique. I've tried to work around this a number of ways, but I can't see a good way to do this generically. THe issue for the most part is that this happens in the guts of the generic business object layer. The value will always be assigned before a save, but right at creation and at addition to the rows collection there may be nothing in the row.
>

Rick:

Can't you do this by assigning negative values that decrease to the primary key field in the datatable? That's how foxpro does it with cursors. I think after a dataadapter.update() the pk fields are set to the server generated values.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/adonetbest.asp
"Best Practices for Using ADO.NET" see the section on "Avoiding Auto-Increment Value Conflicts"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform