New Posts New Posts RSS Feed: Modify Primary Key Value
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Modify Primary Key Value

 Post Reply Post Reply
Author
Markh View Drop Down
Newbie
Newbie
Avatar

Joined: 14-Jun-2007
Location: Australia
Posts: 14
Post Options Post Options   Quote Markh Quote  Post ReplyReply Direct Link To This Post Topic: Modify Primary Key Value
    Posted: 14-May-2009 at 11:03pm
Just using the Learning Units\WinClient-Only\200 Intermediate\Adding and Deleting Entities Example
When I change an order detail (ie Change the Product) and try to save the following exception occurs
 
A referential integrity constraint violation occurred: The property values that define the referential constraints are not consistent between principal and dependent objects in the relationship
 
Is this saying that once a primary key has been created you can not change any of the primary key values!
 
How can you change the OrderDetail to allow the Product to be changed ?
 
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 15-May-2009 at 6:00pm
Well, now that I think about it, I can see how that would create a problem. We can only find the OrderDetail record we want to update in the database by its primary key value, but there's almost certainly no OrderDetail record that matches the primary key value that our local record now has.

With the database as designed, our only recourse is to create a new OrderDetail record (with the Product we want), copy other property values from the existing record, then delete the existing record.

One more reason why I personally avoid composite keys like the plague.

I'll change the Learning Unit solution to make the Product property read-only.

Greg Dunn
Training & Docs Mgr
Back to Top
Markh View Drop Down
Newbie
Newbie
Avatar

Joined: 14-Jun-2007
Location: Australia
Posts: 14
Post Options Post Options   Quote Markh Quote  Post ReplyReply Direct Link To This Post Posted: 17-May-2009 at 5:43pm
Are there any plans to make Primary Keys updatable within DevForce WinClient ?
 
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down