ASP分页后无法读出数据

来源:百度知道 编辑:UC知道 时间:2024/05/22 18:16:12
<%
sql="select id,title joincdate from news where pid="&classcode&" and temflag=1 order by xuhao"
rs.Open sql,cn,1,1
do while not rs.EOF
%>
<option value="product_show.asp?classcode=<%=classcode%>&keyno=<%=rs("id")%>"><%=rs("title")%></option>
<%
if classcode="" then classcode=0
sql="select * from news where pid="&classcode&" and cnflag=1 order by xuhao desc"
rs.pagesize=10 '定义一页显示的记录数目
tatalrecord=rs.recordcount '获取记录总数目
tatalpages=rs.pagecount '获取分页的数目
rs.movefirst
nowpage=request("page") '用request获取当前页数,注意page是自己定义的变量并非函数
if nowpage&"x"="x" then '处理页码为空时的情况
nowpage=1
else
nowpage=cint(nowpage) '将页码转换成数字型
end

rs.Open sql,cn,1,1 参数不正确,不能获取 recordcount, rs.open sql,cn,3,1试一试,当然也可以用 select Count(*) 获取记录数量

rs.Open sql,cn,1,1
我也认为是这个问题,1 的话很多操作作不了
三是可修改,并且一般的话,最好
rs.open sql,cn,3