Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - please help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

please help

 Post Reply Post Reply Page  12>
Author
kim6222 View Drop Down
Newbie
Newbie
Avatar

Joined: 22 April 2005
Location: Malaysia
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote kim6222 Quote  Post ReplyReply Direct Link To This Post Topic: please help
    Posted: 24 May 2005 at 11:19am
please give me the code...how to generate a random data from database...
thanks
Back to Top
xeerex View Drop Down
Senior Member
Senior Member


Joined: 19 November 2002
Location: United States
Status: Offline
Points: 601
Post Options Post Options   Thanks (0) Thanks(0)   Quote xeerex Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
kim6222 View Drop Down
Newbie
Newbie
Avatar

Joined: 22 April 2005
Location: Malaysia
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote kim6222 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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?


Edited by Mart - 25 May 2005 at 2:40am
Back to Top
kim6222 View Drop Down
Newbie
Newbie
Avatar

Joined: 22 April 2005
Location: Malaysia
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote kim6222 Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
kim6222 View Drop Down
Newbie
Newbie
Avatar

Joined: 22 April 2005
Location: Malaysia
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote kim6222 Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2005 at 8:42am
thanks.....but...got any example provided
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post 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.


Edited by dj air - 25 May 2005 at 9:14am
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.