Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Web Form Multiple Selection Checkboxes and Database Inserts
Message
De
19/05/2003 11:56:37
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Web Form Multiple Selection Checkboxes and Database Inserts
Divers
Thread ID:
00790026
Message ID:
00790026
Vues:
56
I am creating a web form that includes a checkbox list control (not yet in Mere Mortals). This is so the user can select multiple items. My question is, What is the best way to capture and insert that into the database (SQL Server 2000)? The options I know about are:

1. Create a related intersection table that creates a row for each person/item combination. Iterate through the list and insert a row for each item.

2. Create a large field in the table to store all the selected values that gets populated by a string buffer collection of all items, perhaps separated by some character other than a comma.

3. Create a field in the table that is binary --inserts a 1 if a particular checkbox list is selected, 0 if not. It keeps adding 1 or 0 for each checkbox item-- eg. 1001. I got this idea from another database developer, but I have no idea how to do it.

4. Create a field in the table for every value that could be selected. Iterate through the list and insert as appropriate--or go back to single checkboxes.

5. Something else??

I am leaning towards #2, but I am not sure it is going to serve me well when I need to query the data for particular values in that one large field.

Does someone have a recommended approach?

Sandra
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform