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 July 27th, 2003, 12:34 AM
Registered User
 
Join Date: Jul 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Want to show Records on ASP Page randomly

AOA All,

I m a regular user of this forum and it realy help me very much in my professional life.i m having a problem and i hope some one ll realy help me in this problem.
Actually i m working on an online store and according to client requirement i want to display some of the products on main page and requirement is to display the products randomly.when some one visit the website he view different products every time.i m using ASP 3 and SQL Server 2000.
A real time example/Code will be appreciated.
Thanks

PKDEV
 
Old July 27th, 2003, 12:25 PM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to vinyl-junkie
Default

How about loading the products into an array via the GetRows method, then calling a random number generator to pick which row (i.e., product) to display? As for generating that random number, here is some sample code for that:
http://www.asp101.com/samples/random_number.asp

Hope this helps. :)

Pat Wong
http://www.napathon.net/ - Music Around The World
For collecting tips, trade and want lists, album reviews and more.
 
Old July 27th, 2003, 02:59 PM
uit uit is offline
Authorized User
 
Join Date: Jul 2003
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just had this need myself, and this site helped me - this page in particular:

http://www.mssqlserver.com/faq/devel...randomrows.asp

Hope it can help you as well..




Quote:
quote:Originally posted by pkdev
 AOA All,

I m a regular user of this forum and it realy help me very much in my professional life.i m having a problem and i hope some one ll realy help me in this problem.
Actually i m working on an online store and according to client requirement i want to display some of the products on main page and requirement is to display the products randomly.when some one visit the website he view different products every time.i m using ASP 3 and SQL Server 2000.
A real time example/Code will be appreciated.
Thanks

PKDEV
 
Old July 28th, 2003, 03:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

This method is much simpler (from http://www.adopenstatic.com/FAQ/randomrecord.asp)
Code:
SELECT
   TOP 1 CategoryID,
   CategoryName FROM
   Categories
ORDER BY
   NewID()





Similar Threads
Thread Thread Starter Forum Replies Last Post
values dont show up on ASP page but exist in DB msoul Classic ASP Basics 2 September 3rd, 2008 02:03 PM
Access DB Records Randomly becomes Chinese scripter Access VBA 3 May 3rd, 2006 05:19 AM
Inserting records to Oracle db from asp page jowjow Classic ASP Basics 0 April 4th, 2006 09:24 AM
inserting records in oracle from asp page jowjow Oracle ASP 0 April 4th, 2006 09:17 AM
Asp (master-)detail's page future's records viewin karib Classic ASP Databases 15 March 23rd, 2004 02:30 PM





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