asp下实现记录集内随机取记录的代码
2023-06-13 09:13: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
%>
<%
" 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链接MySQL实现快速查表(asp链接mysql查表)
- 使用ASP连接MySQL实现数据库应用(asp连接空间mysql)
- ASP搭配MySQL 配置惊艳不凡(asp连接mysql配置)
- ASP程序开发与Oracle数据库结合实现(asp与oracle)
- 利用ASP 与 Oracle 技术实现项目进度管理(asp oracle项目)
- ASP代码的对象化
- [转]ASP实现关键词获取(各搜索引擎,GB2312及UTF-8)
- asp下实现代码的“运行代码”“复制代码”“保存代码”功能源码
- asp下实现UrlEncoding转换编码的代码
- ScriptHtml函数之过滤html标记的asp代码
- 在ASP.Net中实现flv视频转换的代码
- asp.net下文件上传和文件删除的代码
- asp实现本周的一周时间列表的代码
- 为google量身定做的sitemap生成代码asp版
- ASP所有的Session变量获取实现代码
- asp通用修改和增加函数代码
- ASP.NETGridview与checkbox全选、全不选实现代码
- ASP读取日期单日期自动补零函数代码
- asp.net文章分页显示实现代码
- asp.net中使用自定义控件的方式实现一个分页控件的代码
- asp.netBundle功能扩展
- Asp.net利用JQueryAJAX实现无刷新评论思路与代码
- ASP.NET简化编辑界面解决思路及实现代码
- asp.netc#采集需要登录页面的实现原理及代码
- asp.net得到本机数据库实例的两种方法代码
- ASP.NET中为TextBox中添加calendar.js示例代码
- ASP.NET连接sql2008数据库的实现代码