change in primary key in parent grid does not show in child grid foriegn key

nanbudh

New member
Joined
Aug 14, 2006
Messages
1
Programming Experience
Beginner
i have two DataTables tblPersonal and tblPhone which have a DataRelation on a common field 'PersonID'. PersonID is primary key in tblPersonal while it is one of the two primary key fields in tblPhones. this lets me create one to many relationship in the DataBase ie. one person may have many phone numbers. Both tables have been shown in bound DataGrids in the form. The child records DataGrid is bound to Datarelation ie "tblPersonal.PersonalPhones". For the time being the field PersonID is shown in the child grid but i intend to hide it later.
Now the misery is this: when i make a change in parent grid 'PersonID' it does not immedietly reflect in the child grid PersonID field. The change is reflected only if the control is moved to another row in the parent grid and back to changed row. i have tried CurrencyManager.EndCurrentEdit(). There seems to be something in moving to another row and coming back. Please help. i want relection to be immediete or at least when user clicks on the child grid row.
 
Gadzooks Batman! What is possessing you to change the primary key in the first place? There are very VERY few situations that could possibly justify changing the primary key of a record. In fact, ID columns are often invented specifically so you can use a value that will never change, where other attributes of the actual object might. If you have need to change your primary key value then the the odds are heavily weighted towards you having designed your schema incorrectly.
 
Back
Top