比较两个表的值 [英] Comparing the values of two tables

查看:60
本文介绍了比较两个表的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我有两个表,一个是测验,其中存储了问题和正确答案
结果是另一个表,其中存储了用户给出的答案.
总共有10个问题.
如何比较正确答案和用户给出的答案,并为每个正确答案给出0.2分.

我该如何在vb.net中做到这一点.
代码plz

hello,
i have two tables one is quiz in which questions and the correct answer is stored
another table is result in which the answer given by user is stored.
there are total of 10 questions.
how to compare the correct answer and answer given by user and give 0.2 marks for every correct answer .

how can i do this in vb.net.
code plz

推荐答案

好像您要创建四个选择题答案.然后,用户必须选择答案之一,完成后就提交答案?我的意思是,我只是在猜测,因为您说您有两个表,但是您希望在Visual Basic中完成此操作,这些表是否不在数据库中?

例如,创建一个"RadioButtonList"并在其中放置四个"RadioButtons".如果您真的想在Visual Basic中完成所有这些操作,则必须动态创建一个RadioButtonList和四个单选按钮,然后将单选按钮添加到列表中.

至于验证正确答案,请将三个按钮设置为某个值,例如否"或-1.正确的答案应该是……实际答案.然后,我不知道您是如何存储答案的...您要说一张桌子.只需将所选单选按钮的值与答案进行比较即可.

用户将以零分开始,如果问题回答正确,则将分数加.02.

如果您想更具体地说明如何执行此操作(在此处发布您的代码),我将为您修复它,或者,如果您没有代码,并且需要从头开始,请提出问题,我会为您提供帮助.
It looks as if you are creating four multiple choice answers. Then, the user has to select one of the answers and when they are done, they submit them? I mean, I am only guessing because you say you have two tables, but you want this done in Visual Basic, wouldn''t the tables be in a database?

As an example, create a ''RadioButtonList'' and put four ''RadioButtons'' in there. If you really want to do all of this in visual basic, you would have to dynamically create a RadioButtonList and the four radio buttons, then add the radiobuttons to the list.

As far as validating the proper answer, set three of the buttons to some value such as "No" or -1. The right answer would be...the actual answer. Then, I don''t know how you are storing the answers...you say a table. Just compare the value of the radiobutton that was selected with the answer.

The user will start off with a score of zero, and if the question is answered right, add .02 to the score.

If you want to be a little more specific as to how you are doing this (post your code here), I will fix it for you, or if you have no code and need somewhere to start, just ask and I will help you.



在您的情况下,您有两个表.
我已经使用单个表完成了此操作.
当用户启动测试该时间"时,一个表包含Question,Ans1,Ans2,Ans3,Ans4,CorrectAns和SelectedAns.
当用户按下下一步按钮时,该时间将更新SelectedAns字段.每次下一个按钮更新该特定行.当按完成"或结束"按钮时,该时间使用SelectedAns字段计算结果.


尝试这个.它既简单又易于计算结果.
Hi,
In your case you have two table.
I have done this using single table.
When user start Test that time one table contain Question,Ans1,Ans2,Ans3,Ans4,CorrectAns and SelectedAns.
When user press next button that time update SelectedAns field. Every time next button update that particular Row. When Press Finish or End Button that time calculate result using SelectedAns Field.


Try this. It''s simple and Also easy to calculate result.


这篇关于比较两个表的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆