<%
If Request("Page")=Empty Then
Page=1
Else
Page=cint(Request("Page"))
End If
''创建ADO对象
If InStr (Search,"[") <> 0 Or InStr(Search,Chr(39))<>0 then ''若发现不安全字符,则停止执行
Response.Write("<script language=''JavaScript''>history.go(-1)</script>")
Response.End
End If
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeOut = 15
Conn.CommandTimeOut = 30
Conn.Open "ccisn", "", ""
Set rs=Server.CreateObject("ADODB.RecordSet")
''sqlstr="select * FROM xxxx where Feed_Title like ''%"&search&"%'' ORDER BY Feed_Date DESC"
''session("xinxisearch")="select * FROM xinxi where Feed_Title like ''%"&type1&"%'' ORDER BY Feed_Date DESC"
rs.open session("xinxisearch"), conn, adOpenStatic
If rs.Recordcount=0 then
rs.close
conn.close
response.write "目前没有您要找的信息!"
response.end
End If
rs.PageSize=30 ''设置每页的记录数
tcount=rs.RecordCount ''取得所有记录的总数
tpage=rs.PageCount ''取得页面的总数
If Not rs.eof Then
RS.AbsolutePage = PAGE
End If
%>
共有<font color=red><%=tcount%></font>条信息,当前为第<font color=red><%=page%></font>页,共<font color=red><%=tpage%></font>页
<%''以下为上一页和下一页的设置
If page>1 Then
Response.write "<a href=text.asp?page="&page-1&">上一页</a> "
End If
Response.write "页 <font face=Arial><b>"&pagecount&" / "
Response.write page &"</b></font> "
For j=1 to tpage
IF J <> page THEN
response.write "<a href=text.asp?page="&j&">"&j&"</a> "
End If
Next
If page<tpage Then
Response.write "<a href=text.asp?page="&page+1&">下一页</a>"
End If
pagecount=rs.pagecount
I=1
do until rs.EOF or I > RS.PageSize
%>
<br>
<li> <a href="reads.asp?MsgID=<%=RS.Fields(0).Value%>" target="_blank">
<% Response.Write RS.Fields(1).Value%>
</a> <font color="#FF0000"><b>(
<% Response.Write RS.Fields(3).Value%>
)</b></font> ——类别:<%=RS.Fields(2).Value%>
<% rs.MoveNext ''移到下一个记录
I=I+1
loop
rs.close
conn.close
%>
<p><a href=<%=return_to%> >返回</a>
<p>注意:如果您检索时出错,请您在检索时不要用回车,要用鼠标点击搜索按钮!
DO UNTIL rstemp.eof OR howmanyrecs>=maxrecs
'....
rstemp.movenext
howmanyrecs=howmanyrecs+1
LOOP
rstemp.close
There is a better way. It requires you to construct an appropriate SQL statement or use a stored procedure to return only the records for a specific page. The implementation is data-dependent
2. yes, an example from MSDN:
Dim MyArray()
ReDim MyArray(5)
MyArray(0) = "hello"
MyArray(1) = "some other string"
'Store the array in the Session object
Session("StoredArray") = MyArray
'Now retrieve the array from the Session object
LocalArray = Session("StoredArray")
LocalArray(1) = "there"
...
'and then store the updated one back again
Session("StoredArray") = LocalArray