p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: AW: Pulling Random data out of a recordset


Message #1 by "Michael Drozdzowicz [GBase.ch]" <bandit@g...> on Thu, 24 May 2001 16:09:04 +0200
nice option, but those aren't random records,
are they?



-----Original Message-----
From: Dallas Martin [mailto:dmartin@z...]
Sent: Thursday, May 24, 2001 04:48 PM
To: Code Clinic
Subject: [proasp_codeclinic] RE: AW: Pulling Random data out of a
recordset


If your DB is either SQL Server or Acces use the "TOP" modifier in the
SELECT statement
ie. SELECT TOP 5 * from TABLE .......


----- Original Message -----
From: "Tim Thurlings" <tim.thurlings@m...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Thursday, May 24, 2001 10:22 AM
Subject: [proasp_codeclinic] RE: AW: Pulling Random data out of a recordset


> ok, now this works,
>
> but how do i write a piece of coding for lets say 5 random
> rows out of the recordset...
>
>
>
> -----Original Message-----
> From: Michael Drozdzowicz [GBase.ch] [mailto:bandit@g...]
> Sent: Thursday, May 24, 2001 04:09 PM
> To: Code Clinic
> Subject: [proasp_codeclinic] AW: Pulling Random data out of a recordset
>
>
> first u need to get total records in database.
>
>
>
> Randomize timer
> rndNumber = Int(RND * totalrecords)
>
>
> SQLstmt="SELECT * FROM mydb"
> set rs = conn.execute(sqlstmt)
> RS.Move rndNumber
>
> thats all u need.
>
> cu
> Michael
>
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Tim Thurlings [mailto:tim.thurlings@m...]
> Gesendet: Donnerstag, 24. Mai 2001 15:14
> An: Code Clinic
> Betreff: [proasp_codeclinic] Pulling Random data out of a recordset
>
>
> Dear All,
>
> I need to get data out of my recordset, but on random basis.
> Does anyone knows how to do this?
>
> With high hopes,
>
> Tim Thurlings



  Return to Index