Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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....
Posted
Updated 3-Apr-10 20:02pm
v3

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).
 
Share this answer
 
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

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. Don't forget to remove the uniqueID once you have processed the question, otherwise the same one might come up again!

:)
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900