软件教程

ASP随机读取数据库记录最简单方法

来源: 本站    类别: 软件教程    日期: 2011/6/3

 以下是源代码:
Randomize(Timer())
SQL = "SELECT TOP 100 ID FROM table1 ORDER BY Rnd(-(ID + " & Int((10000 * Rnd) + 1) & "))"
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open SQL,Conn,1,1
If Not RS.EOF Then
       RS.MoveFirst
       For I = 1 To RS.RecordCount
              Response.Write RS(0) & "<br>"
              RS.MoveNext
       Next
End If
RS.Close
Set RS = Nothing

相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com