On Feb 6, 9:26 am, Manish <Man...@discussions.microsoft.com> wrote:
> Hi Miguel,
>
> Please refer to the link below to insert the values in the Tags table. You
> will have to specify the firsl column value as newid(), which will create a
> new value for the TagID field.
>
>
http://technet.microsoft.com/en-us/library/ms190348.aspx >
> Regards,
> Manish
www.ComponentOne.com >
> "shapper" wrote:
> > Hello,
>
> > I am creating a table has follows:
>
> > create table dbo.Tags
> > (
> > TagID uniqueidentifier not null
> > default NewID()
> > constraint PK_Tag primary key clustered,
> > TagText nvarchar(100) not null
> > )
>
> > I am using a LinqDataSource and a ListView to create records in this
> > table. I am able to delete and update records but when I insert a
> > record I get the error:
>
> > Violation of PRIMARY KEY constraint 'PK_Tag'. Cannot insert duplicate
> > key in object 'dbo.Tags'. The statement has been terminated.
>
> > In fact I am able to insert ONE record and its ID becomes:
> > 00000000-0000-0000-0000-000000000000
>
> > So when I insert a second one, I suppose, the ID is 000... again and
> > this is why I get the error ...
>
> > What am I doing wrong?
>
> > Thanks,
> > Miguel
In fact this works fine with an SQL Query.