ASP+Access隨機讀取數據庫記錄的方法
深山行者個人網站 2009/4/18 23:18:57 深山行者 字體:
大 中 小 瀏覽 16981
方法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>
|
- 相關閱讀
- 中國簽證行業領導者--91出國簽證網
- windows 部分熱鍵集錦
- asp中最難發現的錯誤由最簡單的程序引起
- 網站策劃:網站欄目和頁面的策劃
- windows xp設置IIS。
- 綿陽市康輝國際旅行社有限責任公司
- 經典的仿藍色理想TAB橫向下拉菜單效果
- 四川省旅者旅行社有限公司總部
- 共有0條關于《ASP+Access隨機讀取數據庫記錄的方法》的評論
- 發表評論