ASP+Access隨機讀取數據庫記錄的方法
深山行者個人網站 2009/4/18 23:18:57 深山行者 字體:
大 中 小 瀏覽 17028
方法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>
|
- 相關閱讀
- windows xp 安裝IIS,設置IIS。
- uni-app開發微信小程序使用button的open-type為contact調用微信客服不能用view或者js調用
- 旅行社網站管理系統免費版 V2.4
- 常用正則表達式集錦
- 在網頁添加創建快捷方式的按鈕
- windows8的iis7應用程序池標識問題
- asp隨機顯示圖象
- 深山行者留言系統V3.0
- 共有0條關于《ASP+Access隨機讀取數據庫記錄的方法》的評論
- 發表評論