从ms-access数据库中随机选择10个问题 [英] Randomly select 10 question fro ms-access database

查看:71
本文介绍了从ms-access数据库中随机选择10个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将vb.net用作前端,将ms-access用作后端
我想从100个问题中随机地从数据库中检索出10个问题
同时在richtextbox中.如果我单击下一步按钮,则显示第二个问题.我使用四个单选按钮作为选项
然后单击完成按钮,然后显示结果以及iam如何将带有用户答案的​​10个问题存储在数据库中.

谢谢....

I am use the vb.net as frontend and ms-access as backend
I want to retrive 10 question randomly from database out of 100 question
simultenously in richtextbox. If i click on next button then second question display. I am use the four radio button for option
and I click on finish button then show the result and how iam store the 10 question with user answer in database.

Thank you....

推荐答案

最简单的方法是将所有问题都提供给您的客户,然后从其中随机选择10个.您应该可以使用主键在表中(或类似内容)选择10个问题.
The simplest approach would be to get all the questions to your client and then randomly select 10 out of them. You should be able to pick 10 using the primary key for questions in the table (or something similar).




这就是我要做的:
1.确保您的问题表具有一个uniqueID字段,其中包含唯一的整数值;
2.使用以下方法之一获取所有这些uniqueID值(或您感兴趣的所有值):
Hi,

this is what I would do:
1. make sure your questions table has a uniqueID field, which holds a unique integer value;
2. fetch all those uniqueID values (or all the ones you''re interested in) using one of these:
SELECT uniqueID FROM table 
SELECT uniqueID FROM table WHERE selection


并将它们存储在一个集合中,例如整数列表
3.现在,每当您需要一个问题时,从列表中随机选择一个uniqueID,然后使用
获取问题


and store them in a collection, say a List of Integers
3. now each time you need a question, randomly pick a uniqueID from your list, and fetch the question using

SELECT * FROM table WHERE uniqueID=theOneYouWant


4.处理完问题后,不要忘记删除uniqueID,否则可能会再次出现相同的问题!

:)


4. Don''t forget to remove the uniqueID once you have processed the question, otherwise the same one might come up again!

:)


这篇关于从ms-access数据库中随机选择10个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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