Hi Aurora,
Looks like your table is already populated with conflicting values. Set the
Unique=true before populating the data.
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development
www.rthand.com
Blog: blog.rthand.com
"Aurora" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a DataTable with two columns : GroupID which is primary key and
> second GroupName which I would like to hold groups name in a unique way,
> so that it may not be two groups with same name.
> Is there a way to set this feature using DataTable class?
> I have tried . dt.Column["GroupName"].Unique = true;
>
>
> and I get as below
>
> System.Data.InvalidConstraintException was unhandled
> Message="Column 'GroupName' contains non-unique values."
> Source="System.Data"
>
> Thanks,
> Aurora
>