Kode untuk catatan acak di set catatan
<%
'MovingTorandomrecord-Stevenjones'Extension
IFNOT (Rekam Set Name.Bofand Rekam Set Name.eof) lalu
'ResetTheCursortothebeginning
If (recordset name.cursortype> 0) lalu
Recordset name.movefirst
Kalau tidak
Recordset Name.Requery
Endif
Recordset name_totalrn = -1
Recordset name_totalrn = recordset name.recordcount'onyWorksOntomerecordsets, ButMuchfaster
If (rekam set name_totalrn = -1) kemudian'andifitdid notwork, westillhavetocounttherecords.
'COMPOTTHETOLRECORDSBYITERATITEDTHROUGHTERCORDSET
Recordset name_totalrn = 0
While (tidak merekam set name.eof)
Recordset name_totalrn = recordset name_totalrn+1
Recordset name.Movenext
Pergi ke
'ResetTheCursortothebeginning
If (recordset name.cursortype> 0) lalu
Recordset name.movefirst
Kalau tidak
Recordset Name.Requery
Endif
Endif
'NowdofinalDjustments, dan Movetotherandamrecord
Recordset name_totalrn = recordset name_totalrn-1
Jika rekaman set name_totalrn> 0then
Mengacak
Recordset name.moveint ((Recordset name_totalrn+1)*rnd)
Endif
Endif
'Alldone; YouShouldalwayscheckforAntemptyrecordsetBeforedIsPlayingData
%>