Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Fetch randomly questions from database in .net 3.5.

i need it for a quiz application.In it all the question are saved in the database and i have to select randomly and have to show on the screen.

I mean different question for different user.
please help me .
Thanks a lot.
Posted

Store all Questions in database and then fetch it randomly from database.
suppose you have sql table named Question, here is the Query to select random Questions.

SQL
SELECT TOP 1 * FROM Question ORDER BY NEWID()
 
Share this answer
 
Use the Random[^] class to generate your database key.
 
Share this answer
 
v2

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