| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 490 人关注过本帖
标题:数组问题
只看楼主 加入收藏
kgdipbyve
Rank: 2
等 级:论坛游民
帖 子:346
专家分:35
注 册:2008-5-4
结帖率:92.31%
收藏
 问题点数:0 回复次数:4 
数组问题
dim p_txt(4),p_img(4),p_url(4)
set rs=Server.CreateObject("adodb.recordset")
  sql="Select  top 5 from [gg] order by zp_id desc"
rs.Open sql,conn,2,3
if not rs.eof then
Response.Write("<script>alert('系统出错!')</script>")
Response.End()
End if
y=0
do while not rs.eof
p_txt(y)=rs("p_txt")
p_img(y)=rs("p_img")
p_url(y)=rs("p_url")
Response.Write(p_txt(y))
Response.Write(p_img(y))
Response.Write(p_url(y))
rs.MoveNext
y=y+1
loop
set rs=nothing
Response.Write(p_txt(0))
Response.Write(p_txt(1))
Response.Write(p_txt(2))
Response.Write(p_txt(3))
Response.Write(p_txt(4))
Response.Write(p_img(0))
Response.Write(p_img(1))
Response.Write(p_img(2))
Response.Write(p_img(3))
Response.Write(p_img(4))
Response.Write(p_url(0))
Response.Write(p_url(1))
Response.Write(p_url(2))
Response.Write(p_url(3))
Response.Write(p_url(4))
Response.End
这句话为什么一直执行
if not rs.eof
...
end if
把NOT 去掉还是执行
Response.Write("<script>alert('系统错误!')</script>")

这句话.
这里到底哪里错了
搜索更多相关主题的帖子: sql 
2008-11-26 09:08
lackyking
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:186
专家分:0
注 册:2008-7-1
收藏
得分:0 
If Rs.Bof And Rs.Eof Then
    ...
End If

http://www.,木公博客
2008-11-26 10:19
lackyking
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:186
专家分:0
注 册:2008-7-1
收藏
得分:0 
"if not rs.eof then" = "if 游标没有达到记录集最后一条 then"

http://www.,木公博客
2008-11-26 10:21
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
dim p_txt(4),p_img(4),p_url(4)
set rs=Server.CreateObject("adodb.recordset")
sql="Select top 5 from [gg] order by zp_id desc"
rs.Open sql,conn,2,3
if rs.eof then
   Response.Write("<script>alert('系统出错!')</script>")
   Response.End()
End if
y=0
do while not rs.eof
   p_txt(y)=rs("p_txt")
   p_img(y)=rs("p_img")
   p_url(y)=rs("p_url")
   Response.Write(p_txt(y))
   Response.Write(p_img(y))
   Response.Write(p_url(y))
   rs.MoveNext
   y=y+1
loop
set rs=nothing
Response.Write(p_txt(0))
Response.Write(p_txt(1))
Response.Write(p_txt(2))
Response.Write(p_txt(3))
Response.Write(p_txt(4))
Response.Write(p_img(0))
Response.Write(p_img(1))
Response.Write(p_img(2))
Response.Write(p_img(3))
Response.Write(p_img(4))
Response.Write(p_url(0))
Response.Write(p_url(1))
Response.Write(p_url(2))
Response.Write(p_url(3))
Response.Write(p_url(4))
Response.End
如果去掉NOT还是弹系统出错,检查SQL语句有没有问题数据库中有没有数据。
2008-11-26 14:38
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
dim p_txt(4),p_img(4),p_url(4)
set rs=Server.CreateObject("adodb.recordset")
sql="Select top 5 from [gg] order by zp_id desc"
rs.Open sql,conn,2,3
if rs.eof then
   Response.Write("<script>alert('系统出错!')</script>")
   Response.End()
End if
y=0
do while not rs.eof
   p_txt(y)=rs("p_txt")
   p_img(y)=rs("p_img")
   p_url(y)=rs("p_url")
   Response.Write(p_txt(y))
   Response.Write(p_img(y))
   Response.Write(p_url(y))
   rs.MoveNext
   y=y+1
loop
set rs=nothing
Response.Write(p_txt(0))
Response.Write(p_txt(1))
Response.Write(p_txt(2))
Response.Write(p_txt(3))
Response.Write(p_txt(4))
Response.Write(p_img(0))
Response.Write(p_img(1))
Response.Write(p_img(2))
Response.Write(p_img(3))
Response.Write(p_img(4))
Response.Write(p_url(0))
Response.Write(p_url(1))
Response.Write(p_url(2))
Response.Write(p_url(3))
Response.Write(p_url(4))
Response.End
如果去掉NOT还是弹系统出错,检查SQL语句有没有问题数据库中有没有数据。
2008-11-26 14:38
快速回复:数组问题
数据加载中...
 
   



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

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