Posted - 12/09/2011 : 10:35:40
| I have a couple questions related to another post but diodnt want to string that post along.
I have 2 tables and trying to figure out how to best handle the PK and FK to maintain relationship while creating new records etc.
I have a Primary Key in both tables (ID), this field in both tables is an automnumber field that simply increase in number as more records are added.
I then created a ParentGUID field in the Parent table which will house a GUID value
I then created a ParentGUID field (varchar) in the Child Table as well as a ChildGUID which will house unique child guid for each record, where the ParentGUID in this child table will maintaint the relationship
On new Parent Record a new GUID will be created
On Child new record a ChildGUID will be created, and the ParentGUID will be grabbed from the Parent Table and placed in the table.
If I make the ID fields in both tables the Primary Keys, how do I handle the ParentGUID in teh Parent Table, and the ChildGUID and ParentGUID in the Child table.
I assume that I cannot make 2 primary keys?
I need a foreign Key on the Child Table (ParentGUID field) back to the Parent Table (ParentGUID field)
Just a bit confused on the setup adn workign of the foreign keys....
I am seperating the ID from the GUIDs because in silverlight I am retrieving the parent GUID and manually placing it in the Childs ParentGUID field...If its the Primary key I dont see it in the silverlights datagrid, nor know how to retierve the PK...