Unique Constraint in Strongly Typed Dataset

Unique Constraint in Strongly Typed Dataset

Post by Ira Gladni » Sun, 19 Jan 2003 04:52:44



When generating a strongly type dataset using the SQLDataAdapter, only
primary key constraints defined in the SQL Server source table seem to
result in unique constraints in the generated datatable.  Source table
unique constraints other than the primary key constraint don't appear
to result in unique constraints in the datatable.

So, how can you use the dataset designer to add non-primary key unique
constraints?  Can't seem to see how this can be done.

I understand how to add the constraint in code, was just wondering if
it could be done in the designer as well.

 
 
 

Unique Constraint in Strongly Typed Dataset

Post by Jed Ozon » Sun, 19 Jan 2003 05:17:24


You can go into View Schema (right click on the DataSet).  Then you can drag
from the Toolbox a Relation onto on of the tables you want to create a
constraint between tables.


Quote:> When generating a strongly type dataset using the SQLDataAdapter, only
> primary key constraints defined in the SQL Server source table seem to
> result in unique constraints in the generated datatable.  Source table
> unique constraints other than the primary key constraint don't appear
> to result in unique constraints in the datatable.

> So, how can you use the dataset designer to add non-primary key unique
> constraints?  Can't seem to see how this can be done.

> I understand how to add the constraint in code, was just wondering if
> it could be done in the designer as well.


 
 
 

Unique Constraint in Strongly Typed Dataset

Post by Ira Gladnic » Sun, 19 Jan 2003 06:15:50


To answer my own question:  Just create a key in the datatable.

I wasn't aware that "key" means "unique constraint" in this context..

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!