All,
On my aspx page i have 2 sets of checkboxlists, each with a number of items and i am storing that info in my db. currently i have my table set up this way:
InfoID--PK auto
UserID-int
CheckBoxList1ID-int
CheckBoxList2ID-int
So a user can select more than 1 item in each checkbox, so this table will contain multiple user-ids and each id from the respective checkboxes. My question is, is there a better way to store this data? I hope this is clear, any input would be greatly appreciated.
Thank you.
I would have a table that holds the values for the checkboxes, and another table that bridges the user table and the checkbox value table. This would only have two fields - the user ID and the selected checkbox ID. This is a better way to manage many-to-many relationships. You would have to iterate through the checkboxes and insert a row for each one the user selected.http://www.mikesdotnetting.com/Article.aspx?ArticleID=53
Thanks mike..actually I do have those other 2 tables as well, and I am pretty much doing it like that link you sent, just didn't know if there was a better way. Since thats the way to go, i am happy i don't have to recode.. . thanks for the response.
No comments:
Post a Comment