| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1397 人关注过本帖
标题:[求助]下标越界
只看楼主 加入收藏
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
 问题点数:0 回复次数:17 
[求助]下标越界

Microsoft VBScript 运行时错误 (0x800A0009)
下标越界: '2'
/wangzhan/admin/zhuanjia5/cpzs_list.asp, 第 76 行

大家帮帮忙,急死了...
红色的代码为第 76 行
谢谢~~



<!--#include file="../inc/conn_other.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../css/2.css" rel="stylesheet" type="text/css">
<link href="../../css/1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-image: url(../../images/bg1111.gif);
}
-->
</style></head>
<body leftmargin="0" topmargin="0">
<table width="99%" height="683" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<%
id =request.QueryString("id")
set rs=server.createobject("adodb.recordset")

page=request.querystring("page")
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=int(page)

sql="select * from zhuanjia where id="&id
rs.open sql,conn,1,1
if rs.eof then
%>
<tr>
<td width="982" height="49"><div align="center" class="text"><font color="#FF0000" size="3">暂时没有专家!!!</font></div></td>
</tr>
<%
response.end
else
rs.pagesize=9
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
i=0

dim Product_id(),Product_name(),Product_pic(),Product_brand(),Product_detail(),Product_address()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve Product_id(i),Product_name(i),Product_pic(i),Product_brand(i),Product_detail(i),Product_address(i)
Product_id(i)=rs("id")
Product_name(i)=rs("xingming")
Product_pic(i)=rs("zhaopian")
Product_brand(i)=rs("zhicheng")
Product_detail(i)=rs("jianjie")
Product_address(i)=rs("dizhi")
rs.movenext
loop
end if
rs.close
%>
<tr>
<%for i = 1 to ubound(Product_id)%>
<td HEIGHT="680" valign="top"><div align="center">
<table align="center" width="650" height="400" border="1" cellpadding="2" cellspacing="2" bordercolor="#999999">
<!--DWLayoutTable-->
<tr>
<td width="142" rowspan="4" valign="top">
<img src="
<%
if trim(Product_pic(i))="" then
response.Write("images/none.jpg")
else
response.Write(trim(Product_pic(i)))
end if
next
%>
" width="139" height="180" border="0" class="text"></td>
<td width="104" height="32" align="center" valign="middle">姓&nbsp;&nbsp;&nbsp;&nbsp;名</td>
<td width="133" valign="top"><%=Product_name(i)%></td>
<td width="89" align="center" valign="middle">职&nbsp;&nbsp;&nbsp;&nbsp;称</td>
<td width="138" valign="top"><%=Product_brand(i)%></td>
</tr>
<tr>
<td height="31" align="center" valign="middle">性&nbsp;&nbsp;&nbsp;&nbsp;别</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td align="center" valign="middle">邮&nbsp;&nbsp;&nbsp;&nbsp;箱</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="36" align="center" valign="middle">联系方式</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td align="center" valign="middle">出生日期</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="81" align="center" valign="middle">擅长专业</td>
<td colspan="3" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="42" align="center" valign="middle">联系地址</td>
<td colspan="2" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
<td align="center" valign="middle">邮&nbsp;&nbsp;&nbsp;&nbsp;编</td>
<td valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr align="center" valign="middle">
<td height="42" colspan="5"> <div align="center">专家简介</div></td>
</tr>
<tr>
<td height="258" colspan="5" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr valign="middle">
<td height="47" colspan="5"><div align="center">学术成果/获得荣誉</div></td>
</tr>
<tr>
<td height="164" colspan="5" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr align="center" valign="middle">
<td height="42" colspan="5"><div align="center">备注</div></td>
</tr>
<tr>
<td height="125" colspan="5" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table>
<br>
<br>
</div></td>
</tr>
</table>

搜索更多相关主题的帖子: Microsoft css 越界 text 
2006-11-28 10:02
tang688
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1219
专家分:35
注 册:2004-12-25
收藏
得分:0 
<%for i = 1 to ubound(Product_id)-1%>
这样试试

2006-11-28 10:06
━╋网情深★
Rank: 1
等 级:新手上路
帖 子:187
专家分:0
注 册:2005-3-18
收藏
得分:0 
<%for i = 0 to ubound(Product_id)-1%>
这样试试

[glow=255,red,2] ╭︿︿☆╮ ╭︿︿︿╮ {/ . .\\}oοО缘份使… {/. . \\} ( (oo) ) …我们相识Оοo( (oo) ) ︶︶︶︶….距离总是太远 …︶︶︶︶oοО相处总是太难Оοo伤心伤神不如失去记忆 [/glow]
2006-11-28 10:21
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
<%for i = 1 to ubound(Product_id)-1%>
改成这样的话,就没出现越界了,但下面代码失效,照片传不过来了,该怎么解决?谢谢
<td width="142" rowspan="4" valign="top">
<img src="
<%
if trim(Product_pic(i))="" then
response.Write("images/none.jpg")
else
response.Write(trim(Product_pic(i)))
end if
next
%>
" width="139" height="180" border="0" class="text"></td>

2006-11-28 10:28
做人很低调
Rank: 5Rank: 5
等 级:贵宾
威 望:18
帖 子:1268
专家分:0
注 册:2006-8-2
收藏
得分:0 
i=0

dim Product_id(),Product_name(),Product_pic(),Product_brand(),Product_detail(),Product_address()
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve Product_id(i),Product_name(i),Product_pic(i),Product_brand(i),Product_detail(i),Product_address(i)
Product_id(i)=rs("id")
Product_name(i)=rs("xingming")
Product_pic(i)=rs("zhaopian")
Product_brand(i)=rs("zhicheng")
Product_detail(i)=rs("jianjie")
Product_address(i)=rs("dizhi")
<i=i+1>要放在这
rs.movenext
loop


你写的这段循环给数组赋值 有问题吧
这个i的递增 要放在数组赋值的后面

其实我很低调,只是你不知道...
2006-11-28 10:36
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
把 i=i+1放到 rs.movenext前面也一样的
照片传不过来

2006-11-28 10:42
做人很低调
Rank: 5Rank: 5
等 级:贵宾
威 望:18
帖 子:1268
专家分:0
注 册:2006-8-2
收藏
得分:0 

你自己看看你写的
<img src="
<%
if trim(Product_pic(i))="" then
response.Write("images/none.jpg")
else
response.Write(trim(Product_pic(i)))
end if
next
%>
" width="139" height="180" border="0" class="text">
你看过这样循环的么
<img>标签就输入一半....好好检查一下你的逻辑
还有你这个<img>标签最好这样写
<%
dim img
if trim(Product_pic(i))="" then
img="images/none.jpg"
else
img=trim(Product_pic(i))
end if
%>
<img src="<%=img%>" width="139" height="180" border="0" class="text">


其实我很低调,只是你不知道...
2006-11-28 11:01
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
兄台

改成你的循环也一样的效果的,不知道怎么回事照片总传不过来 

郁闷了。...

2006-11-28 12:07
做人很低调
Rank: 5Rank: 5
等 级:贵宾
威 望:18
帖 子:1268
专家分:0
注 册:2006-8-2
收藏
得分:0 
那你就看看数据库中的图片路径是不是虚拟路径

其实我很低调,只是你不知道...
2006-11-28 12:09
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
照片路径已经写如数据库了 
是 
images/200611281209580.gif

怎样才能显示不出来这照片

2006-11-28 12:26
快速回复:[求助]下标越界
数据加载中...
 
   



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

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