记录显示问题,求救!各位前辈!!!

popularhand 2002-10-17 02:11:44
我现在建立了一个数据库连接CONN并打开记录集RS(设RS的记录条数大于10)
问:1.我要求每页每次只显示10条记录,当我按下一页是否仍需建立连接和
打开记录集并定位记录。否,请给出详细代码!
2.是否可以将CONN和RS做为用户会话变量即:
SESSION.CONTENTS.ITEM("SCONN")=CONN
SESSION.CONTENTS.ITEM("SRS")=RS
但系统提示无CONTENTS方法,为什么?
...全文
21 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2002-10-18
  • 打赏
  • 举报
回复
还有问题吗?
beckhambobo 2002-10-17
  • 打赏
  • 举报
回复
第一个分页问题可以参照以下程序

rs1.PageSize=5
pageno=clng(request("pageno"))
if pageno<1 then pageno=1
if pageno>rs1.pagecount then pageno=rs1.pagecount
showpage rs1,pageno

以下是showpage函数

sub showpage(rs1,pageno)

rs1.absolutepage=pageno
for n=1 to rs1.pagesize
response.write "<tr>"
response.write "<TD align=middle width=30 ><A href='javascript:O1(62)'><IMG src='images/locktop.gif' width=15 border=0 height='15'></A></TD>"
response.write "<TD align=left width='369'> <A href='javascript:O2(62)'><IMG height=13 src='images/04.gif' width=13"
response.write "align=absMiddle border=0></A> <SPAN id=forum>"
response.write "<A title="&rs1("title")&"nbsp; 发布时间:"&rs1("currenttime")&"nbsp; href='title.asp?forumno="&request("forumno")&"&forumname="&request("forumname")&"&titleno="&rs1("titleno")&"'>"&rs1("title")&"</A> </SPAN></TD>"
response.write "<TD align=middle width=78 >"
response.write "<A href='data.asp?usernameno="&rs1("usernameno")&"'>"&rs1("username")&"</A></TD>"
response.write "<TD align=middle width=30 ><FONT color=#333333>"&rs1("num")&"</FONT></TD>"
response.write "<TD align=middle width=30 ><FONT color=#333333>"&rs1("times")&"</FONT></TD>"
response.write "<TD align=middle width=120 >"
if isnull(rs1("lastdate")) then
response.write rs1("currenttime")
else
response.write rs1("lastdate")
end if
response.write "</TD>"
response.write "<TD width=68 >"
if isnull(rs1("lastman")) then
response.write "......"
else
response.write "<A href='data.asp?usernameno="&rs1("lastno")&"'>"&rs1("lastman")&"</a>"
end if
response.write "</TD></TR>"
rs1.movenext()
if rs1.eof then exit for
next
end sub


freelyl 2002-10-17
  • 打赏
  • 举报
回复
第二个是不可以的。一般CONN我们都放在INCLUDE文件里面,每个ASP都调用一次生成
freezwy 2002-10-17
  • 打赏
  • 举报
回复
在一个分页显示的程序里面,一次打开的CONN完全可以支持的呀,没有任何疑问的,如果你要写进去也应该这样写:
不过建议不要把RS放进session中。
session("sconn")=conn
session("srs")=rs
cmsoft 2002-10-17
  • 打赏
  • 举报
回复
一般可以放在application中

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧