|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Application Design QuestionThis is just a simple application design question. I was just wondering how different people would approach this problem. Suppose you had to design a form where you edit a record and in the form there is a list box. You can select multiple items in the list box that are tied to that record. (Say for example, suppose you have a record that's a car. You can select multiple options related to the car. power locks, power windows, automatic transmission, etc) It would be a 1 - n relationship. In the database, you have a master record in table A. (The car) And multiple records in another table B with a foreign key relationship. (The options on the car) When a user submits the form. (Or clicks a button, whatever you wish) How would you attack this problem? Delete all the records in table B and insert the new records. Or would you compare the values of the list box and table B and update accordingly? Which is the better design approach? Thanks! dfa_geko
Show quote
"dfa_geko" <nospam@nospam.com> wrote in message We have a similar model, what we do is maintain a toBeAdded and a news:Xns991BD6608D4DDnospamnospamcom@69.28.173.184... > Hi Everyone, > > This is just a simple application design question. I was just wondering > how > different people would approach this problem. > > Suppose you had to design a form where you edit a record and in the form > there is a list box. You can select multiple items in the list box that > are > tied to that record. (Say for example, suppose you have a record that's a > car. You can select multiple options related to the car. power locks, > power > windows, automatic transmission, etc) It would be a 1 - n relationship. > > In the database, you have a master record in table A. (The car) And > multiple records in another table B with a foreign key relationship. (The > options on the car) > > When a user submits the form. (Or clicks a button, whatever you wish) How > would you attack this problem? Delete all the records in table B and > insert > the new records. Or would you compare the values of the list box and table > B and update accordingly? > > Which is the better design approach? > > Thanks! > > dfa_geko toBeDeleted list. When the model is sent to the server we just iterate through these lists. David McCallum I would delete the ones there, then add the new ones. Doing a match/merge
to figure out what changed, etc., isn't worth the effort unless you're doing your own audit trailing. Robin S. ------------------------ Show quote "dfa_geko" <nospam@nospam.com> wrote in message news:Xns991BD6608D4DDnospamnospamcom@69.28.173.184... > Hi Everyone, > > This is just a simple application design question. I was just wondering > how > different people would approach this problem. > > Suppose you had to design a form where you edit a record and in the form > there is a list box. You can select multiple items in the list box that > are > tied to that record. (Say for example, suppose you have a record that's a > car. You can select multiple options related to the car. power locks, > power > windows, automatic transmission, etc) It would be a 1 - n relationship. > > In the database, you have a master record in table A. (The car) And > multiple records in another table B with a foreign key relationship. (The > options on the car) > > When a user submits the form. (Or clicks a button, whatever you wish) How > would you attack this problem? Delete all the records in table B and > insert > the new records. Or would you compare the values of the list box and > table > B and update accordingly? > > Which is the better design approach? > > Thanks! > > dfa_geko |
|||||||||||||||||||||||