回 帖 发 新 帖 刷新版面

主题:错误类型:ADODB.Recordset (0x800A0CC1)


错误类型:ADODB.Recordset (0x800A0CC1)在对应所需名称或序数的集合中,未找到项目。 

代码如下: 

<% 
dim rscity,sqlcity 
set rscity=server.createobject("adodb.recordset") 
sqlcity = "select * from city2 order by paixu desc" 
rscity.open sqlcity,conn,1,1 
%><SCRIPT language = "JavaScript"> 
var onecount; 
onecount=0; 
subcat = new Array(); 
<% 
count = 0 
do while not rscity.eof 
%> 
subcat[<%=count%>] = new Array("<%= trim(rscity("city2"))%>","<%= trim(rscity("city1"))%>","<%= trim(rscity("id"))%>"); 
<% 
count = count + 1 
rscity.movenext 
loop 
rscity.close 
%> 
onecount=<%=count%>; 

function changelocation(locationid) 

document.myform.city2.length = 0; 

var locationid=locationid; 
var i; 
for (i=0;i < onecount; i++) 

if (subcat[i][1] == locationid) 

document.myform.city2.options[document.myform.city2.length] = new Option(subcat[i][0], subcat[i][2]); 




</SCRIPT><% 
sqlcity = "select * from city1 order by paixu desc" 
rscity.open sqlcity,conn,1,1 
if rscity.eof and rscity.bof then 
response.write "请先添加栏目。" 
response.end 
else 
%><SELECT name="city1" onChange="changelocation(document.myform.city1.options[document.myform.city1.selectedIndex].value)" size="1"> 
<OPTION selected value=>分类</OPTION> 
<%do while not rscity.eof 
%><OPTION value="<%=trim(rscity("id"))%>"><%=trim(left(rscity("city1"),chr(32)))%></OPTION> 
<% 
rscity.movenext 
loop 
end if 
rscity.close 
%></SELECT> 
<SELECT name="city2"> 
<OPTION selected value=>二级分类</OPTION> 
</SELECT>

问题补充:就是提示这行出错<OPTION value="<%=trim(rscity("id"))%>"><%=trim(left(rscity("city1"),chr(32)))%></OPTION> 

我这个是一个下拉菜单来的,字段名应该是没有错,浏览后就出现上面的错误提示。 

city1这个表中的大类,city2是表中的小类

请大虾门帮我看看是那里出错!

回复列表 (共1个回复)

沙发

<%=trim(left(rscity("city1"),chr(32)))%>中的chr(32)是空格,肯定不符合left函数的语法,换成任意数字就行,如 10,试试

我来回复

您尚未登录,请登录后再回复。点此登录或注册