Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 December 21st, 2006, 08:37 AM
Authorized User
 
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP - Random values from database

Hello,

I have a question:

Suppose I have a table named as tblfriends and there are 3 columns with several row. Column names are: name, email, phone

I want to pick 5 names randomly from the table each time my asp page refreshes.


How can this be coded in classic asp?



Thanx for your help

-----------------------------------------------
www.chargertek.in - Cheapest WebHosting
__________________
-----------------------------------------------
www.chargertek.in - Cheapest WebHosting
 
Old December 21st, 2006, 01:24 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Get the max row count from your table and then generate a random number that is not to excced the max row count. Use this as a reference to using Rnd()

http://www.asp101.com/samples/viewas...dom_number.asp

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get random column values? seismik SQL Server 2005 3 November 21st, 2006 06:02 PM
Random Result from Database Ravenwillow Beginning VB 6 2 June 27th, 2005 02:46 PM
random numbers from/to database HammR PHP Databases 10 January 14th, 2005 12:08 PM
Generating random values gatsby VB How-To 3 August 4th, 2004 02:33 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.