ASP - Random values from database

Discussion in 'C#' started by cancer10, Dec 21, 2006.

  1. #1
    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
     
    cancer10, Dec 21, 2006 IP
  2. venom

    venom Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can actually get this using a sql statement, if you are using ms sql or msde you could use

    
    select top 5 * from tblfriends order by newid()
    
    Code (markup):
    That will return a random list of 5 records from the db
     
    venom, Dec 21, 2006 IP