Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2004, 11:22 AM
Registered User
 
Join Date: Mar 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generating 5 unique random records from a database

Generating 5 unique random records from a database....

--------------------------------------------------------------------------------

im using ASP.NET/VB.NET. i have a MS Access database of questions and 4 multiple choice answers for each question. i would like to know if it is possible to randomly generate 5 different questions on a page with its multiple choice answers from the database at the same time but making sure that each question displayed is not displayed again in one instance.

there are various examples on the net but have'nt found any that can help me solve this. im really stuck now....can anyone please help me out??????

Thanks........


 
Old March 8th, 2004, 01:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Either store the questions in the DB per user, or maybe storing a custom DataTable object holding the question ID's in it, then put the data table in the Session or Cache objects. If you are using the Cache object, make sure that in the global.asax.vb file, you specify "Cache.Remove" in the Session_End method. That way, when the session ends, they can start over. Or you can use the Cache and specify an expiration period too, and do it that way. If you want a predefined expiration period, you can't use the Session object.

What level of retention do you want? User sessions time, 20 minutes, 1 day, 2 days, a month?

Brian Mains
 
Old March 8th, 2004, 05:59 PM
Registered User
 
Join Date: Mar 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi brian,
thanks mate. yea ok will do. im designing this for a quiz system where users will be given multiple choice quizzes when they log into the site. im using sessions but i need to have a database with a standard set of questions that applies when the choose the option to take the quiz so i cannot have a sert of questions for each user. im fairly new to htis so have u come across any examples of this on the net? if so then the help is much appreciated and thanks for the help mate!!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating random numbers invisibleman18 Java Basics 2 March 26th, 2007 12:22 AM
Unique Records arholly Access 9 December 14th, 2006 08:22 AM
Generating random values gatsby VB How-To 3 August 4th, 2004 02:33 PM
help with random records ps124 ASP.NET 1.0 and 1.1 Basics 0 March 14th, 2004 10:57 PM
random records from database HammR PHP Databases 1 December 11th, 2003 02:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.