Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Guid
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Re: Guid
Divers
Thread ID:
01062064
Message ID:
01062103
Vues:
17
Russ,

>I am experiencing an error when saving records to a SQL table. The primary key of the table is eqc_pk, the field type is uniqueident, is RowGuid is set to yes.

>on my business object I have set the RetrieveAutoIncrementPK to false
>
>I can save one record (if I check the SQL table, the record is properly inserted with a GUID); however, if I attempt to create a second record during the same session I recieve an error:
>"Column 'eqc_pk' is constrained to be unique. Value '' is already present."
>
>If I have the RetrieveAutoIncrementPK to true, I cannot save the first record, I recieve the following error:
>
>Cannot insert the value NULL into column 'eqc_pk', table 'ArbyEqp.dbo.EquipmentClass'; column does not allow nulls. INSERT fails.
>The statement has been terminated.
>
>I prefer to have SQL create the GUID, but am unsure how to set MM to accomplish this.

MM .NET'RetrieveAutoIncrementPK is specifically designed for auto-incrementing primary keys generated by Identity columns, not for GUID columns. You should either turn off RetrieveAutoIncrementPK or convert your primary key field to an identity column.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform