Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
I have started one as Asynchronous Learning system
in which Questions will be uploaded to a question bank (Database.)

and the upon request Random questions will be selected and displayed to the user
with question and Radio buttons for choices, then a feedback will be displayed when the form is submitted.

What kind of piece of code can be used to select questions from database randomly,
and display them in a well formed way???
Posted
Comments
Steve Maier 23-Mar-12 12:11pm    
What version of C# / ASP.NET are you using?
basitex 24-Mar-12 16:35pm    
ASP.NET 2010, with Ajax,

1 solution

You could use something like the following:

SQL
select top 1
    Column1,
    Column2,
    ...
from
    Table_Name
tablesample (n percent)


where n is any integer between 1 and 100.

Here is an article with more detail: Limiting Result Sets by Using TABLESAMPLE[^]
 
Share this answer
 
Comments
Nelek 23-Mar-12 20:53pm    
Hi Mark, I don't know if you already saw it but I have noticed that many QA where you have contributed are not getting your name by the "updated X hours ago".
R. Giskard Reventlov 24-Mar-12 9:58am    
Thanks: hadn't noticed. Is it important? I really have no idea.
Nelek 25-Mar-12 7:15am    
AFAIK, all QA work good, just your name missing in info. I don't know if it is important or not, just pointed it out.
basitex 24-Mar-12 16:33pm    
thanks!

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