国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

asp下實現記錄集內隨機取記錄的代碼

2024-05-04 11:00:58
字體:
來源:轉載
供稿:網友
記錄集內隨機取記錄的代碼

<% 
' 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
%> 

  
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 梅河口市| 瑞安市| 怀化市| 股票| 乌拉特前旗| 杭锦后旗| 镇康县| 怀宁县| 铜鼓县| 黄平县| 科技| 卓尼县| 宝坻区| 嵊州市| 临海市| 静安区| 图片| 田阳县| 湖口县| 沧州市| 元谋县| 安庆市| 建始县| 海安县| 集安市| 汝城县| 鄂伦春自治旗| 武功县| 正蓝旗| 故城县| 阜新市| 铜山县| 固始县| 甘孜县| 东城区| 婺源县| 德阳市| 孝昌县| 民丰县| 苗栗县| 麻阳|