Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Constraint Confusion (Part II)
Message
From
02/09/2003 12:50:18
 
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00825285
Message ID:
00825368
Views:
11
Hiya Steve!! Long time, no see!!

Yeah, I'm still not clear as to why Rick's DataSets enforced the constraints and mine don't. Nobody's answered that question yet, AFAIK.

~~Bonnie



>I'd hoped that the ADO.NET DataSets would import/inherit/read the database constraints and allow those to be enforced on the client side. However, my experimentation seems to indicate that this is not the case.
>
>Using the Northwind customers table with the following constraints:
>
>ALTER TABLE [dbo].[Customers] ADD
> CONSTRAINT [PK_Customers] PRIMARY KEY CLUSTERED
> ([CustomerID]
> ) ON [PRIMARY] ,
> CONSTRAINT [CK_ContactRequired] CHECK (len([ContactName]) > 0)
>
>And using a SqlCommand object, SqlConnection object and SqlDataAdapter to fill the DataSet, the Constraints.count is zero, and I can add all the records I want with a blank contact and duplicate CustomerID values.
>
>In another thread on this topic I note that Bonnie Berent reported that she's seeing the same behavior that I am, but Rick Strahl implies that his DataSets/DataTables are indeed picking up the constraints from the underlying tables.
>
>Any light shed would be appreciated...
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform