MSSQL:select top 10 * from [table] order by newid()
ACCESS:
复制代码 代码如下:
'以利用rs.move嘛 '如随机取10条 n = 10 '先要判断总记录数是否少于10,若小于10,则有多少取多少 if n>10 rs.recordCount then n=rs.recordCount dim ranNum for i = 1 to n Randomize() ranNum = int(rs.recordCount*rnd)+1 '产生一个随机数 rs.Move ranNum '移动游标到随机数位置 response.write i "-" rs("title") "br />" '输出内容 rs.Move -ranNum next '……