#22003/8/23 11:49:58
记录集的名称叫做abc,我这样写出错在什么地方啊!请大家回帖!!
<%
' Moving to random record - Steven Jones' Extension
If Not(abc.bof and abc.eof) Then
' reset the cursor to the beginning
If (abc.CursorType > 0) Then
abc.MoveFirst
Else
abc.Requery
End If
abc_totalrn = -1
abc_totalrn = abc.RecordCount ' ony works on some recordsets, but much faster
If (abc_totalrn = -1) Then ' and if it didn't work, we still have to count the records.
' count the total records by iterating through the recordset
abc_totalrn=0
While (Not abc.EOF)
abc_totalrn = abc_totalrn + 1
abc.MoveNext
Wend
' reset the cursor to the beginning
If (abc.CursorType > 0) Then
abc.MoveFirst
Else
abc.Requery
End If
End If
' now do final adjustments, and move to the random record
abc_totalrn = abc_totalrn - 1
If abc_totalrn > 0 Then
Randomize
abc.Move Int((abc_totalrn + 1) * Rnd)
End If
End If
' all done; you should always check for an empty recordset before displaying data
%>