专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Asp教程 » oracle随机取记录:记录集内随机取记录的代码 »正文

oracle随机取记录:记录集内随机取记录的代码

来源: 发布时间:星期四, 2009年2月12日 浏览:95次 评论:0


<%
\' Moving to random record - Steven Jones\' Extension
If Not(记录集名称.bof and 记录集名称.eof) Then
\' re the cursor to the beginning
If (记录集名称.CursorType > 0) Then
记录集名称.MoveFirst
Else
记录集名称.Requery
End If

记录集名称_totalrn = -1
记录集名称_totalrn = 记录集名称.RecordCount \' _disibledevent=>\' count the total records by iterating through the record
记录集名称_totalrn=0
While (Not 记录集名称.EOF)
记录集名称_totalrn = 记录集名称_totalrn + 1
记录集名称.MoveNext
Wend

\' re 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 record before displaying data
%>



0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: