Let's say that I have three tables "Person", "Area", and "Person_Area". Each person can work in many areas and each area can have many people in them. "person_Area" is a bridge table that contains person_id and area_id
In my code I have two asp list boxes located on a person form. List box one contains all available areas and list box two can be populated with areas from list box one based on user selection. The areas that get put into list box two are the areas that a person is in.
This is all fine and easy, but when I decide to save to my database I am unsure how to Insert, Update, Delete the "person_Area" table. I don't want to reinsert an area for a person if it is already in the table and if the user removes an area from list box two how does the code know to delete it when I post back to the server?
Would it be reasonable to just delete all records in the "Person_Area" table for the specific person and then re-add all the current user selections? or is there a better option? I am stumped.