| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1298 人关注过本帖
标题:[求助]为什么rsObj.recordCount和rsObj.pageCount读出来是-1
只看楼主 加入收藏
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
结帖率:100%
收藏
 问题点数:0 回复次数:4 
[求助]为什么rsObj.recordCount和rsObj.pageCount读出来是-1

<%
dim connstr '连接字符串
dim db '数据库文件路径

db = "../database/golfers.mdb"
connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
set rsObj = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM news WHERE 1 = 1"
strSQL = strSQL&" ORDER by newsid desc"
rsObj.Open strSQL, conn, 2,1
rsObj.pagesize = conMaxPerPage
%>
<%=rsObj.recordCount%><br><%=rsObj.pageCount%>
数据库里是有数据的

搜索更多相关主题的帖子: rsObj pageCount recordCount 
2007-04-29 17:02
guyer
Rank: 2
等 级:新手上路
威 望:5
帖 子:451
专家分:0
注 册:2007-1-19
收藏
得分:0 
好象是什么东西不支持 我也忘. 给你看下我的代码

http://www./
2007-04-29 17:20
guyer
Rank: 2
等 级:新手上路
威 望:5
帖 子:451
专家分:0
注 册:2007-1-19
收藏
得分:0 


<!--#Include file="adovbs.inc"--> // 需要此文件
<!--#Include file="conn.inc"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="text.css" rel="stylesheet" type="text/css">
</head>

<body>

<div align="center">
<%
rs.cursortype=3
str="select * from gqgx Order By id desc"
rs.open str,conn,3,1
%>
<table width="80%" height="550" border="1" bordercolor="aa0000">
<tr>
<td height="510" align="center" valign="top"><form name="form1" method="post" action="">
<table width="100%" border="0">
<tr bgcolor="bb0000">
<td width="33%" height="20"><div align="center" class="style6">标题</div></td>
<td width="33%" height="20"><div align="center" class="style6">关系</div></td>
<td width="33%" height="20"><div align="center" class="style6">操作</div></td>
</tr>
<% if rs.eof or rs.bof then
response.write "<td>没有信息记录</td>"
else %>
<% rs.pagesize=15 %>
<% if request("page")="" then
page=1
else
page=CLng(request("page"))
end if
%>
<%
IF page<1 Then
page=1
end if
If page>rs.pagecount Then
page=rs.pagecount
rs.absolutepage=page
end if
%>
<%
rs.absolutepage=cint(page)%>
<% for ipage=1 to rs.pagesize %>
<%
id=rs("id")
title=rs("title")
types=rs("gqgx")
Notice=rs("Notice")
response.Write("<tr bgcolor=#CCCCCC>")
response.Write("<td height=20><div align=center>"&title&"</div></td>")
response.Write("<td height=20><div align=center>"&types&"</div></td>")
if Notice=true then
response.Write("<td height=20><div align=center><A href=xggqgx.asp?id="&id&"><font color=000000>修改</font></a> | <a href=# onClick=""javascript:if(confirm('确定要删除吗?')) location.href='dele.asp?cz=5&id="&id&"';""><font color=000000>删除</font></a> | <a href=laws.asp?cz=5&czz=1&id="&id&"><font color=000000>取消公告</font></a></div></td>")
else
response.Write("<td height=20><div align=center><A href=xggqgx.asp?id="&id&"><font color=000000>修改</font></a> | <a href=# onClick=""javascript:if(confirm('确定要删除吗?')) location.href='dele.asp?cz=5&id="&id&"';""><font color=000000>删除</font></a> | <a href=laws.asp?cz=5&czz=2&id="&id&"><font color=ff0000>设为公告</font></a></div></td>")
end if
response.Write("</tr>")
%>
<% rs.moveNEXT
IF rs.EOF Then
Exit For
End If
next
end if
%>
</table>
</form></td>
</tr>
<tr>
<td height="20"><div align="center"><table width="330" border="0" align="center" bgcolor="#FFFFFF">
<tr>
<%
'翻页控制代码
IF page<>1 Then
Response.Write("<td><a href=glgqgx.asp?page=1><font color=000000>第一页</font></a></td>")
Response.Write("<td><a href=glgqgx.asp?page="&(page-1)&"><font color=000000>上一页</font></a></td>")
Else
Response.Write("<td>第一页</td>")
Response.Write("<td>上一页</td>")
End IF
IF page<>rs.pagecount then
Response.Write("<td><a href=glgqgx.asp?page=" & (page+1) & "><font color=000000>下一页</font></a></td>")
Response.Write("<td><a href=glgqgx.asp?page=" & rs.pagecount & "><font color=000000>最后一页</font></a></td>")
Else
Response.Write("<td>下一页</td>")
Response.Write("<td>最后一页</td>")
End IF
%>
<td><span class=style22>共<%=rs.pagecount%>页</span></td>
<td align="left"><span class=style22>当前第<%=page%>页</span></td>
</tr>
</table></div></td>
</tr>
</table>
</div>
</body>
</html>


http://www./
2007-04-29 17:22
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
哦,谢谢

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-04-29 18:35
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
9Z5FLGNV.rar (18.33 KB) [求助]为什么rsObj.recordCount和rsObj.pageCount读出来是-1


我把文件传上来了,各位帮忙看看.
就是数据库news表中有11个数据.但是pageguide.asp中的
<div align = "right"><%=rsObj.recordCount%>项,第<%=page%>/<%=rsObj.pageCount%> 页 
语句中的rsObj.recordCount和rsObj.pageCount显示为-1.

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-04-29 18:51
快速回复:[求助]为什么rsObj.recordCount和rsObj.pageCount读出来是-1
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025780 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved