Information générale
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Network:
Windows 2003 Server
Tim,
I want to use guid's as the primary keys in my SQL tables and as I add a new row, I want to generate a guid for the new row in the DataTable. This should solve the problem of adding multiple new rows in the DataTable before saving them all to the backend SQL database.
How do I generate the guid's? What SQL Data Type should the guid column be?
Sam
>Hi Sam,
>
>As far as the constraint goes this must be a identity with an auto increment at the database level. One solution would be to turn that off and assign it yourself. When you create the records and they navigate to create another, just fill in the value so you don't have a constraint issue. This would be best with Guid's or something that you won't have to track the values with of course, but could be done with integers but a bit more work.
>
>I do this myself using guid's in a project that is creating several records before saving them all.
>Tim
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement