1
votes

I have 480 textboxes in one form. They are grouped in 4 textboxes (120 groups). I also have 1 more textbox to put the file number.I need to store the values in a table in SQL. Should I create a table with 480 columns or is there an easier way to do it ?
Example: l1,w1,q1,p1(group1); l2,w2,q2,p2;........l120,w120,q120,p120. When I press "Save", all values should be stored in SQL. If i clear all the textboxes and press "Retrieve" button, all the values should show in the textboxes based on the File Number chosen.
Any help is much appreciated.

1
Sounds like you should have built a user control that you replicate 120 times. - D Stanley
Will you need to query the DB against any of these textbox values? That is, will you ever say "show me all files where w2='123'? - n8wrl
"Should I create a table with 480 columns or is there an easier way to do it ?" I highly doubt it. It sounds like you need a table with 6 columns; the four values, a key for the "group" and a key for the "file number". What do the groups and the 4 values represent? 480 text boxes is a lot for one form. - D Stanley
I agree - if you're putting 480 text fields on a form, you're probably doing something wrong from a UI standpoint. There must be an easier way, perhaps using a datagrid or reconceptualizing how the user should interact with your application. - ChicagoMike

1 Answers

0
votes

Based on the information you have provided I would use the following:

T_FORM
 - ID (PK)

T_FORM_DETAIL
 - ID (PK)
 - L
 - W
 - Q
 - P
 - FORM_ID (FK to T_FORM.ID)

So you will end up with multiple rows for the same form that you can easily retrieve knowing the form ID. This solution is also generic enough so you can easily scale that up.

Cheers