Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Failed to enable constraints
Message
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01118876
Message ID:
01118898
Views:
11
Turns out the query for the child bizobj was the problem:

SELECT *,TableB.CategoryCode FROM TableA JOIN TableB ON ...

This brings in all of the TableB fields in (table b has a PK field), I changed the query to

SELECT TableA.*,TableB.CategoryCode FROM TableA JOIN TableB ON ...

And the problem went away.

>Hi I have a parent->child form.
>
>Here's the data:
>
>
>Parent
>======
>
>id     Name
>---    ----
>P1     Rick
>P2     Chris
>
>Child
>=====
>
>ParentId   CategoryCode  Sequence
>--------   ------------  --------
>P1         C1            1
>P1         C1            2
>P1         C2            3
>P2         C3            4
>
>
>
>The child table doesnt have a primary key. In addition, as you can see, the child table has duplicate category codes within the same parent id.
>
>In the child bizobj, I set PrimaryKey to "" (since there's no PK). The child data is not going to be modified. I register the child bizobj as a child of the parent. When I navigate to parent P1, I get the following error "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
>
>The data is sql server, there is a non-unique index on the ParentId field.
>
>I have tried setting
>
>this.PrimaryKeys = new string[] {"ParentId", "CategoryCode","Sequence"};
>
>figuring this might work but I get the same error -
>
>Any ideas?
>TIA,
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Previous
Reply
Map
View

Click here to load this message in the networking platform