ASP+Access隨機(jī)讀取數(shù)據(jù)庫記錄的方法
深山行者個人網(wǎng)站 2009/4/18 23:18:57 深山行者 字體:
大 中 小 瀏覽 17097
方法01 以下是引用片段:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="qiconn.asp"--> <% Randomize(timer()) bgsql = "select top 5 fuid,id,lcolor,name from lei order by rnd(-(id + " & Int((10000 * Rnd) + 1) & "))" set bgrs=server.CreateObject("adodb.recordset") bgrs.open bgsql,conn,1,1 if bgrs.eof and bgrs.eof then response.write "" else do until bgrs.eof response.write bgrs("name") & "<br>" bgrs.movenext loop end if bgrs.closd set bgrs=nothing %> </body> </html>
|
方法02 以下是引用片段:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="qiconn.asp"--> <% dim rndnum Randomize Do While Len(rndnum)<2 num1=CStr(Chr((57-48)*rnd+48)) rndnum=rndnum&num1 loop Randomize bgsql = "select * from lei where id>"& rndnum &" order by rnd(id) desc" set bgrs=server.CreateObject("adodb.recordset") bgrs.open bgsql,conn,1,1 if bgrs.eof and bgrs.eof then response.write "" else do until bgrs.eof response.write bgrs("name") & "<br>" bgrs.movenext loop end if bgrs.closd set bgrs=nothing %> </body> </html>
|
- 相關(guān)閱讀
- 專注于戶外擴(kuò)展、商務(wù)會議建站解決方案
- 東莞市潮流假期旅行社有限公司
- 一個可以用來思考的故事,非常不錯
- 啟動旅行社管理系統(tǒng)3.0的開發(fā)服務(wù)
- 經(jīng)典的仿藍(lán)色理想TAB橫向下拉菜單效果
- javascript編寫的網(wǎng)頁版的打字測試程序
- html中meta標(biāo)簽詳解
- 連云港旅游協(xié)會
- 共有0條關(guān)于《ASP+Access隨機(jī)讀取數(shù)據(jù)庫記錄的方法》的評論
- 發(fā)表評論