> In your relationship definition, enforce referential integrity and check the > Cascade Update (and Cascade Delete if you will be deleting records) setting. > I think that should take care of it.
No, it doesn't work. > Technically, you may also turn off the "enforce referential integrity", but > I would not recommend it. It doesn't work either. > The problem you experience is that there is no simple way to update the > tables and maintain the referential integrity: > > If you modify the "child" first - it won't have a "parent" yet. > If you modify the "parent" first, you will orphan the "child". > > If all else fails, you can probably work around this by: > > 1: Copy the original parent record, but assign it the new primary key > value. > 2: Modify the child to reference the new parent. > 3: Delete the old parent. > > Updating a primary key is NOT a good practice. This is one of the main > reasons many database designers choose not to use the "natural" keys as the > primary key, but rather establish a "meaningless" primary key, such as an > Identity/AutoNumber column. You are right, but sometimes situation arises, and you have to do that. I am writng an application allowing registered users to do certain things at my site. These users are mostly students/faculty/staff. When they register they may not be willing to submit real student id number. Later on they find they cannot do something useful things, such as renew their library checkouts, exchange messages with others. They may change their mind to give a real id number. Your idea of generating an identical table is too cumbersome for this purpose. Looks like we have to wait for someone to call in, and change their id in GUI. Any better ideas? Thanks, Kelly > HTH, > Tore. > > -----Original Message----- > From: Kelly Zhu [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 28, 2002 1:22 PM > To: ActiveServerPages > Subject: update value for a primary key field > > > I have a db in Access. I cannot use ASP page to change the value of a field > assigned with primary key and has a one-to-many relationship with a field in > another table. But I have no problem doing the same thing in Access. The > ASP page doesn't give me error, but just doesn't do the job. > > Please help. Thanks. > > Kelly > > > --- > You are currently subscribed to activeserverpages as: [EMAIL PROTECTED] > To unsubscribe send a blank email to > %%email.unsub%% > > --- > You are currently subscribed to activeserverpages as: [EMAIL PROTECTED] > To unsubscribe send a blank email to %%email.unsub%% --- You are currently subscribed to activeserverpages as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED]
