select
top
6
*
from
content
where
s_id=1
order
by
newid()
如果是access
ORDER
BY
rnd(id)
<%Set conn=server.CreateObject("adodb.connection")
conn.provider="microsoft.jet.oledb.4.0"
conn.open server.mappath("english.mdb")Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from sentence",conn,1,1'先读取全部记录max=rs.recordcount ‘读取最大记录数
For i=1 To 7 ’随机输出7个
randomize
id=Int(Rnd(now)*max+1) ‘定义从1到最大记录数之间的随机记录号
rs.absoluteposition=id ’定义记录集的绝对指针
Response.Write rs(0)&rs(1)&rs(2)
Next
%>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)