Last post Jul 01, 2008 02:15 PM by hollyquinn
Jun 25, 2008 03:40 AM|aligenius|LINK
Hi! Please help me to find a solution that my records will appear on the datagrid that random-access accordingly to their ID Field.
I m using Access Database.
Jun 25, 2008 03:52 AM|ca8msm|LINK
How can they be random if you want it based on an ID field? If they were truly random they would be selected based on no criteria.
Website Design Darlington - http://lessthandot.com -
Jun 26, 2008 06:27 AM|Mikesdotnetting|LINK
SELECT * FROM MyTable
ORDER BY Rnd(-10000000*TimeValue(Now())*[ID])
Replace * with the fields/columns you want to select, and MyTable
with the name of your table and ID with the name of your ID Field.
Jul 01, 2008 02:15 PM|hollyquinn|LINK
Hi, as I've been looking for information about how to display a random record from an Access database, I keep running across your SQL statement above as replies to different messages. Would you mind to provide a little more information on how to utilize
this? I am trying to display a random record from an access database. Right now there are 10 records. Just two columns ID and vFact (which is a string). This is the code I currently have:
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
fact.DataSource = objDataReader