Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
General MM .NET question
Message
De
07/03/2009 00:07:54
 
 
À
04/03/2009 17:49:21
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01384040
Message ID:
01386369
Vues:
43
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
Fil
Voir

Click here to load this message in the networking platform