1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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