Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
In my application i have a web page where i have to answer nearly 60 sums. Each sum have a textbox(say txtSum1,txtSum2....) to answer. I have to insert these sums answer to Database. Normally how i do is (for 10 sums) i created 10 columns in a table and names as sum1,sum2,sum3.... ...and insert the sum1 answer to sum1 column and so...But for 60 sums it is not a good method.. plz tell me how to insert these 60 sums value to database(just tell me what are the colunms i needed. Should i create 60 columns or any other method).
Posted 20-Jan-13 20:39pm
shamjid1.4K
Edited 20-Jan-13 20:54pm
v3
Comments
shamjid at 21-Jan-13 5:14am
   
no need to get sums of text fields. what i need is i have to save the answer of each question to check whether he typed correct answer or not...each sum ll have a default answer..

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It really depends on what you want to do with them later.
 
Since there are always 60 text boxes, (although that's a lot for a user to cope with in one go, I'd consider cutting them down to six pages of ten or so) I would probably go with the "60 columns in a row" approach, if I needed to do any arithmetic ot calculation on they values later. If I was just keeping them for reference, then I would probably use a single column, and concatenate the answers together into a single CSV value.
 
The only other approach is to have a whole separate table with a row per text box, each row having a ID linkiing it back to the original page row and some indication of the textbox number. Nasty, and wasteful.
  Permalink  
Comments
OriginalGriff at 21-Jan-13 3:50am
   
Same thing - you either need sixty columns somewhere, or a single column with all results.
You gotta store something somewhere! :laugh:
shamjid at 21-Jan-13 5:20am
   
i actually cut this to 2 pages..Thatis 30 question in a page and i decided to create a page Id...from question 1 - 30 i save it in page Id 1 and remaining as 2..so i just have to create 30 columns...
OriginalGriff at 21-Jan-13 5:33am
   
Better - It may be that 30 is still too many - I don't know how your page(s) look so I can't be sure. It's better not to overwhelm the user with inputs though - it can get depressing and look like "hard work" if there are too many on a page. And look patronising if there are too few! :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 489
1 Nirav Prabtani 298
2 OriginalGriff 215
3 _Amy 165
4 PIEBALDconsult 150
0 OriginalGriff 7,755
1 Sergey Alexandrovich Kryukov 6,951
2 Maciej Los 3,994
3 Peter Leow 3,698
4 CHill60 2,742


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100