Categories

Updated: 07/12/2007

Selecting random record from database

This ASP source code describes a short way to select a record from database. First we need to calculate how many records we have in our table. Using randomize function, we generate a random number between 0 to count of records in database. Last part of code to select our record using our random number. We must move dynamic cursor in database table and move it to row number. There a few ways to move cursor to row, but personally we can do it similiar as paging records. We select all records from table dividing one record per page. Complete reference code is included.
©2003-2019 jCay.com