Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 10 question which are retrieved from a database.

Whenever I login each and every time iIshould get the shuffled question.

If I login as 1 username I got the same question and if I login as 2 username I got the same question.

My requriment is it should be in shuffled manner.


Please help me.
Posted
Updated 23-Nov-11 22:18pm
v2
Comments
Reiss 24-Nov-11 3:17am    
Repost of a repost http://www.codeproject.com/Questions/287815/ramdomly-selecting-questions-from-database
Dalek Dave 24-Nov-11 4:19am    
Edited for Grammar, Spelling and Readability.

use the following query
SQL
SELECT TOP 10 * FROM YourTable ORDER By NEWID()


for more details please see the link http://haacked.com/archive/2004/06/21/658.aspx[^]
 
Share this answer
 
v3
Comments
Member 8388026 24-Nov-11 4:28am    
yes i worked out in database.but when i write the same query in the .cs file the questions are get changed randomly they are not stable.in the web page only they are changing randomly.
now what to do.....?
 
Share this answer
 
Comments
Dalek Dave 24-Nov-11 4:19am    
Indeed, change the random seed.

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