为什么我的Rs.PageCount=-1?

yelang 2006-02-27 02:26:33
正面是我的一段代码,结果执行之后,Rs.PageCount=-1 这是为什么啊?


Conn.connectionstring="Provider=SQLOLEDB.1;UID=sa;PWD=;Initial Catalog=Northwind;Data Source=ZLZ"
Conn.connectiontimeout=30
Conn.open

if err.number>0 then
response.Write("数据库错误" & err.description & err.Number & "
")
end if

StrSQL="SELECT * FROM Products"
rs.open StrSQL,Conn,adOpenDynamic,adLockOptimistic,adCmdText
if err.number>0 then
response.Write("数据库错误" & err.description & err.Number & "
")
end if

rs.pagesize=4
Page=Clng(request("Page"))

if Page<1 then Page=1
if Page>rs.pagecount then page=rs.pagecount
...全文
197 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
5410 2006-02-27
  • 打赏
  • 举报
回复
rs.open StrSQL,Conn,adOpenDynamic,adLockOptimistic,adCmdText

改成rs.open StrSQL,Conn,1,1
ttkkyy 2006-02-27
  • 打赏
  • 举报
回复
conn.cursorlocation=3
xxuu503 2006-02-27
  • 打赏
  • 举报
回复
加上这句:conn.cursorlocation=aduserclient
yelang 2006-02-27
  • 打赏
  • 举报
回复
要是等于一就好了啊,可是输出来的结果是-1啊!
德仔 2006-02-27
  • 打赏
  • 举报
回复
if Page<1 then Page=1
if Page>rs.pagecount then page=rs.pagecount


你的page是小于1的,也可能为0值,但你下面这句就让他等于1了

28,406

社区成员

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

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