在我的应用程序中,我有一个网页,我必须回答近60个总和。每个总和都有一个文本框(比如txtSum1,txtSum2 ....)来回答。我必须将这些总和答案插入数据库。通常我是怎么做的(10个总和)我在一个表中创建了10列,并将其命名为sum1,sum2,sum3 .... ...并将sum1的答案插入sum1列,所以...但是对于60个总和它不是一个好方法.. plz告诉我如何将这60个sums值插入数据库(只需告诉我我需要什么colunms。我应该创建60列或任何其他方法)。
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).
推荐答案这取决于你以后想要用它们做什么。 因为总有60个文本框,(虽然那个'''很多用户可以一次性应对,我会考虑将它们减少到六页十分左右)如果我需要做任何算术,我可能会选择连续60列的方法以后计算它们的值。如果我只是保留它们作为参考,那么我可能会使用一个列,并将答案连接成一个CSV值。 唯一的其他方法是有一个完整的单独的表,每个文本框有一行,每行有一个ID链接回原始页面行和一些文本框号的指示。讨厌,浪费。 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.
更多推荐
插入方法到Sql Server 2008的60个文本框..
发布评论