<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\asp\data1.mdb" ' oledb for ado2.0 up only
sql="Select * From table1"
'Set rs=conn.Execute(sql)
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open Sql, conn, 3, 3 ' µéͧ 1 ¡Ð 3 äÁè§Ñé¹ãªé PageSize PageCount äÁèä´é
TotalTips=rs.RecordCount ' 10 OK áµèÂÔ觹éÍÂÂÔè§àÊÕÂàÇÅÒ random
' Response.Write TotalTips & "<br>"
With Response
.Write "<html>"
.Write "<head><title>µÑÇÍÂèÒ§·Ô»»ÃШÓÇѹẺÊØèÁ</title>"
.Write "<meta http-equiv='content-type' content='text/html;charset=windows-874'>"
.Write "<link rel=stylesheet type=text/css href='content.css'>"
.Write "</head><body><br>"
End With
' ********* random ·Ô»ÁÒµÒÁµÑÇá»Ã no
strTemp=","
iCount=1
no=request.form("random")
'response.write no
Do While iCount<no+1
Randomize
RandomNo=Int((TotalTips)*Rnd()) ' àÃÔèÁ·Õè 0 ¹Ð ÍÂèÒÅ×Á
' Rnd() return 0 <= x <1
' ÇÔ¸Õãªé Int((upperlimit - lowerlimit+1)*Rnd() + lowerlimit) á»Å§à»ç¹¨Ó¹Ç¹àµçÁ
If Instr(1,strTemp, "," & RandomNo & ",")=0 Then
strTemp=strTemp & RandomNo & ","
iCount=iCount+1
rs.MoveFirst
rs.Move RandomNo
' #######################
With Response
.Write "ª×èÍ " & rs("name") & "<br>"
.Write "¤³Ð " & rs("major") & "<BR>"
.Write "..............................<br><br>"
End With
' #######################
End If
Loop
rs.Close
Set rs=Nothing
conn.Close
Set conn=Nothing
%>