Click here to Skip to main content
15,918,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to randomise id based on my database.
eg i need to call out everything for topicid = 1
and there are 26 questions for topic 1

i need to randomised and call out 10 (non repeatable)

store in array session.

thanks.
Posted

Hi,

Execute this query against your db:
SQL
SELECT TOP 10 * 
FROM 
	[YourTableName]
WHERE
	topicid = 1
ORDER BY NEWID()

and use classic ADO.NET (SqlConnection, SqlCommand, SqlDataReader) to get your data into array...
 
Share this answer
 
Comments
thebusygirl 7-Feb-12 3:37am    
THANKS :D
 
Share this answer
 
Comments
thebusygirl 7-Feb-12 3:38am    
THANK YOU
Anuja Pawar Indore 7-Feb-12 4:10am    
You are welcome, but complete caps means shouting.

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