Select Random rows

mentalhard

Well-known member
Joined
Aug 7, 2006
Messages
123
Programming Experience
Beginner
VB.NET:
SELECT TOP 2 ID, Rnd([ID]) AS Expr1, fname, lname 
FROM users
ORDER BY Rnd([ID]);

the SELECT Statement works perfect inside MS Access environment. I made a query for testing purpose and it works. then i tried the same statement from vb.NET application (ASP.NET) and it returns the same two records all the time.

What's wrong with this statement so it doesn't work in .NET environment. And have i other options to get two random rows from the table users?

Thanks :)
 
I think i have found solution. Namely i am using where clause and executing the reader object two times with two different random value.

random.Next(1, 2000)

However thanks for the reply :)
 
Back
Top