MSSQL:select top 10 * from [table] order by newid()
ACCESS:
復制代碼 代碼如下:
'以利用rs.move嘛 '如隨機取10條 n = 10 '先要判斷總記錄數是否少于10,若小于10,則有多少取多少 if n>10 rs.recordCount then n=rs.recordCount dim ranNum for i = 1 to n Randomize() ranNum = int(rs.recordCount*rnd)+1 '產生一個隨機數 rs.Move ranNum '移動游標到隨機數位置 response.write i "-" rs("title") "br />" '輸出內容 rs.Move -ranNum next '……