Print Page | Close Window

please help

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=15206
Printed Date: 30 March 2026 at 5:05am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: please help
Posted By: kim6222
Subject: please help
Date Posted: 24 May 2005 at 11:19am
please give me the code...how to generate a random data from database...
thanks


-------------
kim6222



Replies:
Posted By: xeerex
Date Posted: 24 May 2005 at 11:48am
Hi,

Maybe its a language issue, but asking a little more nicely would help.Smile

What sort of random data are you trying to generate? That can be done without a database.Wink


-------------
http://webspacegeeks.com - Need Hosting, Domains, Dedicated Servers?
http://www.smartergeek.com - web design | pc support | training | podcasts | video production


Posted By: kim6222
Date Posted: 24 May 2005 at 11:17pm
hahah...ok ok...would help...???
yes....i want something like random sort data using asp...
but i got a huge of data into my database...
please provide me some code.....thanks


-------------
kim6222


Posted By: Mart
Date Posted: 25 May 2005 at 2:40am
Do you mean you want to select a random set of records from your database?

EDIT: And what database are you using? Access? MSSQL?


Posted By: kim6222
Date Posted: 25 May 2005 at 6:32am
yes...i want select a random set of record from my database
i am using access....
please help me...
thanks..


-------------
kim6222


Posted By: dj air
Date Posted: 25 May 2005 at 7:34am
if you where using SQL you could use a SQL element name that gets a random record

the only way i know to do so within access is to bring in all records and then .move random number


rndMax = CInt(object.RecordCount)
object.MoveFirst


Randomize Timer
rndNumber = Int(RND * rndMax)
object.Move rndNumber



Posted By: kim6222
Date Posted: 25 May 2005 at 8:42am
thanks.....but...got any example provided

-------------
kim6222


Posted By: dj air
Date Posted: 25 May 2005 at 9:13am
i have just used one of these i n one of my applications to get a random featured item here is a snipit of it (code wise)

this is actual code and works


     strSQL = "SELECT " & strTablePrefix & "Items.Stock, " & strTablePrefix & "Items.New_stock_date, " & strTablePrefix & "Items.Item_ID, " & strTablePrefix & "Items.Item_name, " & strTablePrefix &"Items.Item_price, " & strTablePrefix & "Items.List_price, " & strTablePrefix & "Items.Item_short_description, " & strTablePrefix & "Items.Small_image FROM " & strTablePrefix & "Items WHERE " & strTablePrefix & "Items.Active = True AND " & strTablePrefix & "Items.Featured = True  AND " & strTablePrefix & "Items.Stock > " & intOutOfStock & "  AND " & strTablePrefix & "Items.Cat_ID = " & intCatID & " ORDER BY " & strTablePrefix &"Items.Sort ASC, " & strTablePrefix &"Items.Item_name; "

     rsCommon2.cursortype = 1

     rsCommon2.open strSQL, adoCon

     if rsCommon2.eof then
     
     else

rndMax = CInt(rsCommon2.RecordCount)
rsCommon2.MoveFirst

Randomize Timer
rndNumber = Int(RND * rndMax)
rsCommon2.Move rndNumber     



this line     

rsCommon2.cursortype = 1 allows you to move dynaticlly through the

recrdset and select a random record

then bring the details as ussual. the aboe works as i have just installed the above in some code thaty im working on .. for a Access version application.


Posted By: kim6222
Date Posted: 25 May 2005 at 11:10am
thanks....

-------------
kim6222



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net