c# mysql 文件存储,使用C#在数据库中存储数据

Hi guys,

I have developed a project using windows forms, this project generates true or false questions from the database. The questions are displayed on a form in textbox and there two radio buttons one for "TRUE" and the other for "FALSE" to be selected by the user. is there simpler way I can store the answers that have selected by users into a database table.

I mean I know how I can insert the selected answer into a database table but my only issue that if I have got 10 questions and 5 users answering questions, does this mean I have to create a table for each and every user in order to insert the question and the select answer .. or will I have to insert the details in one table and have redundancy data?

I really really hope this makes sense and I am not asking anyone to do it for me.. I just need ideas

Thank you guys

解决方案

To be more specific than what SA already answered, you'll want to create a table named answers, or something like that. You'll need a column for the user_id, the question_id, and then the answer.

So, if you ever need to find all answers for a given user you can query based on user_id or if you want to see all answers for a given question you can query on question_id, etc.

You need to learn creation of dababase design (schema) and data modeling, this is quite a big topic, but… some reading:

http://en.wikipedia.org/wiki/Single_Point_of_Truth[^] (immediate answer to one of your questions),

http://en.wikipedia.org/wiki/Database_schema[^],

http://en.wikipedia.org/wiki/Database_normalization[^],

http://en.wikipedia.org/wiki/Data_modeling[^],

http://en.wikipedia.org/wiki/Database_integrity[^].

In practice, for many simple problems, like yours, people develop the sense of right schema and model pretty quickly, with experience. For some other problems, it could be very difficult issue requiring a lot of professionalism, to say the least.

—SA

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值