asp怎么样从数据库access调用随机新闻
展开全部
可行的方法
Randomize(Timer())
SQL = "SELECT TOP 10 id,title FROM news 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 "<li><a href=newshow.asp?id="&RS("id")&">"&rs("title")&"</a></li><br>"
RS.MoveNext
Next
End If
RS.Close
Set RS = Nothing
Randomize(Timer())
SQL = "SELECT TOP 10 id,title FROM news 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 "<li><a href=newshow.asp?id="&RS("id")&">"&rs("title")&"</a></li><br>"
RS.MoveNext
Next
End If
RS.Close
Set RS = Nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询