<%
Response.Buffer=True
Db = "D:\hosting\wwwroot\yuzhiguo_com_ufhost\database\data_w#eb_site_2007.mdb"
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&db
SqlNowString="Now()"
SqlChar="'"
On Error Resume Next
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请联系管理员解决此问题!"
Response.End
End If
On Error GoTo 0
%>
方法一:
Randomize(Timer())
SQL = "SELECT TOP 100 ID FROM table1 ORDER BY Rnd(-(ID + " & Int((10000 * Rnd) + 1) & "))"
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open SQL,Conn,1,1
If Not RS.EOF Then
RS.MoveFirst
For I = 1 To RS.RecordCount
Response.Write RS(0) & "<br>"
RS.MoveNext
Next
End If
RS.Close
Set RS = Nothing