
Signature
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
thanks Bob Barrows [MVP]
it's not working i have tried
can you plz tell me what will be the problem
here is the query,
Randomize()
intRandomNumber = Int (1000*Rnd)+1
strSQL = _
"SELECT TOP 4 id, name,image, Rnd(" & -1 * (intRandomNumber) &
"*id)" & _
"FROM products " & _
"ORDER BY 3"
could it be the problem of connection ?
here is my connection file
set conn = server.createobject("adodb.connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
server.mappath("../private/dbase.mdb")
conn.open connstr
Bob Barrows [MVP] - 24 Feb 2007 14:38 GMT
> thanks Bob Barrows [MVP]
>
[quoted text clipped - 6 lines]
> Randomize()
> intRandomNumber = Int (1000*Rnd)+1
Response.Write the number to make sure you are getting a different one each
time the page runs:
Response.Write intRandomNumber
> strSQL = _
> "SELECT TOP 4 id, name,image, Rnd(" & -1 * (intRandomNumber) &
[quoted text clipped - 3 lines]
>
> could it be the problem of connection ?
Nope. Totally irrelevant. Er ... you don't only have three records in that
table do you? ;-)

Signature
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Mike Brind - 24 Feb 2007 17:46 GMT
> thanks Bob Barrows [MVP]
>
[quoted text clipped - 12 lines]
> "FROM products " & _
> "ORDER BY 3"
Change it to read ORDER BY 4. That's the ordinal position of the field to
order by (the random number), which in the example was the third field,
whereas in your, it's the 4th. Your third field is image. so currently it
will always return the row with the image that is alphabetically first.
--
Mike Brind
hardik - 27 Feb 2007 14:43 GMT
hi friends finally this thing work for me
Randomize()
intRandomNumber = Int (1000*Rnd)+1
strSQL = _
"SELECT TOP 4 pid, pname,image, Rnd(" & -1 * (intRandomNumber) &
"*pid)" & _
"FROM product_master " & _
"ORDER BY 4"
it perfectly works for me
Thank you all of you persons