作家
登录

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

作者: 来源:www.28hudong.com 2013-03-30 09:07:50 阅读 我要评论

<% ' Moving to random record - Steven Jones' ExtensionIf Not(记录集名称.bof and 记录集名称.eof) Then' reset the cursor to the beginningIf (记录集名称.CursorType > 0) Then记录集名称.MoveFirstElse记录集名称.RequeryEnd If记录集名称_totalrn = -1记录集名称_totalrn = 记录集名称.RecordCount ' ony works on some recordsets, but much fasterIf (记录集名称_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=0While (Not 记录集名称.EOF)记录集名称_totalrn = 记录集名称_totalrn + 1记录集名称.MoveNextWend' reset the cursor to the beginningIf (记录集名称.CursorType > 0) Then记录集名称.MoveFirstElse记录集名称.RequeryEnd IfEnd If' now do final adjustments, and move to the random record 记录集名称_totalrn = 记录集名称_totalrn - 1If 记录集名称_totalrn > 0 ThenRandomize记录集名称.Move Int((记录集名称_totalrn + 1) * Rnd)End If End If' all done; you should always check for an empty recordset before displaying data%>

  推荐阅读

  利用批处理文件和 vbs 脚本实现网站视频自动录制

利用批处理文件和 vbs 脚本实现网站视频自动录制 现在电视台基本上都有了自己的门户网站,我们可以充分利用网络的优势来扩大本地电视台的影响。事实上,将本地电视台的每日的王牌节目挂在网站上的做法已经成为建立>>>详细阅读


本文标题:记录集内随机取记录的代码

地址:http://www.17bianji.com/kaifa2/ASP/33323.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)