我不太会用数组,
rs.open"select * from .....where ",conn,1,1
for i=0 to rs.recordcount
bbaa[i]=rs("typename")
rs.movenext
next
是这样的吗
我的数据库表改成这样了:两个表
Class_Table:
ID Class
subclass:
Subid Subclass Classid(就是第一个表的ID)
让左侧导航条从数据库读数据
代码如下:你帮我改改吧,这个老是报错
<!--#include file="conn.asp" -->
<html>
<head><style type="text/css">
#abcdefg tr td{width:100px;height:30px;background:#f1f2f3;text-align:center;position:relative}
.aa{position:absolute;top:0px;left:100px;display:none;}
</style>
</head>
<script language="javascript">
function aa_1(b,a){
b.style.background="#d1d2d3"
eval("document.getElementById('a_"+a+"').style.display='block'")
}
function aa_2(b,a){
b.style.background="#f1f2f3"
eval("document.getElementById('a_"+a+"').style.display='none'")
}
function bb_1(a){
a.style.background="#d1d2d3"
}
function bb_2(a){
a.style.background="#f1f2f3"
}
</script>
<body>
<table id="abcdefg">
<%set rc=server.CreateObject("adodb.Recordset")
rc.open"select * from Class_Table",conn,1,1
if not(rc.eof and rc.bof) then %>
<tr><td onmouseover="aa_1(this,1)" onmouseout="aa_2(this,1)"><%=rc("Class")%><table class="aa" id="a_1">
<% k=rc("ID")
set rs=server.CreateObject("adodb.Recordset")
rs.open"select * from subclass where Classid='"&k&"'",conn,1,1
response.Write(rs)
for i=1 to rs.recordcount
%>
<tr><td onmouseover="bb_1(this)" onmouseout="bb_2(this)"><%=rs("Subclass")%></td></tr>
<%
rs.movenext
next
rs.close
set rs=nothing
%>
</table>
<%
rc.movenext
rc.close
set rc=nothing
%>
<%end if%>
</body>
</html>
报错:
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/xinwen/32.asp,行35
也就是这行rs.open"select * from subclass where Classid='"&ra("ID")&"'",conn,1,1
[此贴子已经被作者于2007-7-22 10:52:02编辑过]
好的,我把它分成了两个表:Class_Table
subclass
Class_Table的Class是一级菜单
subclass里的Subclass是二级菜单
<%
set rc=server.CreateObject("adodb.Recordset")
rc.open"select * from Class_Table",conn,1,1
if not(rc.eof and rc.bof) then
%>
<table id="abcdefg">
<%
Do While Not Rc.Eof
%>
<tr><td onmouseover="aa_1(this,1)" onmouseout="aa_2(this,1)"><%=rc("Class")%><table class="aa" id="a_1">
<%
k=rc("ID")
set rs=server.CreateObject("adodb.Recordset")
rs.open"select * from subclass where Classid='" & k &"'",conn,1,1
response.Write(rs)
for i=1 to rs.recordcount
%>
<tr><td onmouseover="bb_1(this)" onmouseout="bb_2(this)"><%=rs("Subclass")%></td></tr>
<%
rs.movenext
next
rs.close
set rs=nothing
Rc.MoveNext
Loop
%>
</table>
<% End IF%>