alguem teria uma outra solucao??
<% abreconexao sql= "SELECT top 3 * FROM tabela ORDER by RND(id)" set recad = conexao.execute(sql) while not recad.EOF %>
Posted 04/02/2004, 13:29
<% abreconexao sql= "SELECT top 3 * FROM tabela ORDER by RND(id)" set recad = conexao.execute(sql) while not recad.EOF %>
Posted 04/02/2004, 13:33
Posted 04/02/2004, 14:21
Dim IDs(), iCont
For i = 1 to 3
Set RS = conexao.Execute("SELECT * FROM tabela;")
If Not RS.EOF Then
ReDim IDs(0)
iCont = 0
Do While Not RS.EOF
iCont = iCont + 1
ReDim Preserve IDs(iCont)
IDs(iCont) = RS("id")
RS.movenext
Loop
RS.close
set RS = nothing
Randomize
idrnd = IDs(iCont * Rnd)
Set RSrnd = conexao.execute("SELECT * FROM tabela WHERE id = '" & idrnd & "';")
response.write RSrnd("id")
RSrnd.close
Set RSrnd = nothing
next
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)