I have a gridview for a table(A) that has a many-to-many relationship with one table(B), and a one-to-many relationship with another(C). If the B and C have items that need to be associated with an item in A, can I simply have the user edit the foreign key
fields in the Table A gridview to include the items (SQL Database Backend)? For example:
1st B Item PK: alpha
2nd B Item PK: beta
A Item FK for Table B: alpha, beta
^ two items from table B are now related to the item in A by adding both PKs to the FK field in the gridview of Table A.
nsa08001
0 Points
37 Posts
Gridview cell editing foreign key field
Apr 18, 2012 03:52 PM|LINK
I have a gridview for a table(A) that has a many-to-many relationship with one table(B), and a one-to-many relationship with another(C). If the B and C have items that need to be associated with an item in A, can I simply have the user edit the foreign key fields in the Table A gridview to include the items (SQL Database Backend)? For example:
1st B Item PK: alpha
2nd B Item PK: beta
A Item FK for Table B: alpha, beta
^ two items from table B are now related to the item in A by adding both PKs to the FK field in the gridview of Table A.
Is there a way to make this work?
Mark-yu
Participant
888 Points
127 Posts
Re: Gridview cell editing foreign key field
Apr 23, 2012 01:21 AM|LINK
Hi
Consider the SQL principle, before you modify table A the foreign key field, you should modify table B the primary key field.
So I think before you edit the foreign key fields in table A, you can do something to edit the B ,C in code behind.
nsa08001
0 Points
37 Posts
Re: Gridview cell editing foreign key field
Apr 23, 2012 01:51 PM|LINK
Thank you for replying, but that doesn't really help me.