记录集内随机取记录的代码 <% ' Moving to random record - Steven Jones' Extension If Not(记录集名称.bof and 记录集名称.eof) Then ' reset the cursor to the beginning If (记录集名称.CursorType > 0) Then 记录集名称.MoveFirst Else 记录集名称.Requery End If 记录集名称_totalrn = -1 记录集名称_totalrn = 记录集名称.RecordCount ' ony works on some recordsets, but much faster If (记录集名称_totalrn = -1) Then ' and if it didn't work, we still have to count the records. ' count the total records by iterating through the recordset 记录集名称_totalrn=0 While (Not 记录集名称.EOF) 记录集名称_totalrn = 记录集名称_totalrn + 1 记录集名称.MoveNext Wend ' reset the cursor to the beginning If (记录集名称.CursorType > 0) Then 记录集名称.MoveFirst Else 记录集名称.Requery End If End If ' now do final adjustments, and move to the random record 记录集名称_totalrn = 记录集名称_totalrn - 1 If 记录集名称_totalrn > 0 Then Randomize 记录集名称.Move Int((记录集名称_totalrn + 1) * Rnd) End If End If ' all done; you should always check for an empty recordset before displaying data %>
推荐阅读
asp清空application的方法
做网站中,如果用到了大量的application会占用大量的服务器资源,所以我们在退出后台的时候可以,清空下数据,网站的运行速度也会快Application 对象实现在给定的应用程序的所有用户之间共享信息,并在服务器运行期>>>详细阅读
本文标题:asp下实现记录集内随机取记录的代码
地址:http://www.17bianji.com/kaifa2/ASP/32330.html
1/2 1