Results 1 to 2 of 2

Thread: Return random cell value of 2 fields

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Location
    Netherlands
    Posts
    97

    Return random cell value of 2 fields

    Hi all,

    I'm making a generator for Premisses (in film-making this is used to describe the main-characters' development) to generate a random premisse.

    A premisse is: "CHARACTERS' MAIN PROPERTY" leads to "SITUATION"

    I have a database that has all possible characters' main property in Field1, and the possible situation in field2.
    How can I return a random cell value from field1 into label1, and random value from field2 into label2 ?
    The connection with the database is set, and the last piece of code is con.open()

    Thanks in advance!
    My Programming Software: Visual Basic 2010
    My Database Program: Office Access 2010

  2. #2
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Return random cell value of 2 fields

    Is this using SQLServer? If so there's a trick you can use with the NEWID function. It generates a random guid so you can use it to randomly order a dataset then pick the first record:-
    Select Top 1 * From MyTable Order By NEWID()
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width