asp 实现随机排序
时间:2011-11-28
来源:互联网
exec2="select * from neirongliebiao where id="&rs1("id")&""
set rs2=server.createobject("adodb.recordset")
rs2.open exec2,conn,1,3
do while not rs2.eof %>
如何实现随机排序??每次打开结果都不一样?
set rs2=server.createobject("adodb.recordset")
rs2.open exec2,conn,1,3
do while not rs2.eof %>
如何实现随机排序??每次打开结果都不一样?
作者: tcnxm23 发布时间: 2011-11-28
http://yangyong2008620.blog.163.com/blog/static/85907162200911835054698/
作者: p2227 发布时间: 2011-11-28
引用 1 楼 p2227 的回复:
http://yangyong2008620.blog.163.com/blog/static/85907162200911835054698/
http://yangyong2008620.blog.163.com/blog/static/85907162200911835054698/
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'
[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'id=1ORDER BY Rnd(-123*id)' 中。
/ceshi112233/quanbu.asp,行 52
还是不行啊
作者: tcnxm23 发布时间: 2011-11-28
<%
Function randNum(lowerbound, upperbound)
Randomize Time()
randNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
End Function
exec2 = "select * from neirongliebiao where id=" & rs1("id")
set rs2 = Createobject("adodb.recordset")
rs2.CursorLocation = 3
rs2.open exec2,conn,1,3
n = rs2.RecordCount
Dim a()
ReDim a(n)
For i = 0 To n-1
a(i) = i
Next
For i = 0 To n-1
r1 = randNum(0, n-1)
t = a(r1)
r2 = randNum(0, n-1)
a(r1) = a(r2)
a(r2) = t
Next
For i=0 To n-1
rs2.MoveFirst
rs2.Move a(i)
Response.Write rs2("id")
Next
rs2.close
Set rs2 = Nothing
conn.close
Set conn = Nothing
%>
Function randNum(lowerbound, upperbound)
Randomize Time()
randNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
End Function
exec2 = "select * from neirongliebiao where id=" & rs1("id")
set rs2 = Createobject("adodb.recordset")
rs2.CursorLocation = 3
rs2.open exec2,conn,1,3
n = rs2.RecordCount
Dim a()
ReDim a(n)
For i = 0 To n-1
a(i) = i
Next
For i = 0 To n-1
r1 = randNum(0, n-1)
t = a(r1)
r2 = randNum(0, n-1)
a(r1) = a(r2)
a(r2) = t
Next
For i=0 To n-1
rs2.MoveFirst
rs2.Move a(i)
Response.Write rs2("id")
Next
rs2.close
Set rs2 = Nothing
conn.close
Set conn = Nothing
%>
作者: hookee 发布时间: 2011-11-28
引用 3 楼 hookee 的回复:
<%
Function randNum(lowerbound, upperbound)
Randomize Time()
randNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
End Function
exec2 = "select * from neirongliebiao where id=" &a……
<%
Function randNum(lowerbound, upperbound)
Randomize Time()
randNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
End Function
exec2 = "select * from neirongliebiao where id=" &a……
还是成功不了啊!我就是想让这个页面的结果每次出现的顺序都不一样!怎么办
作者: tcnxm23 发布时间: 2011-11-28
报什么错?
作者: hookee 发布时间: 2011-11-28
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28