<body>
<%
set rs=server.CreateObject("adodb.recordset")
sqlstr="Select * from [allclass] where inherit=9 and webtop=1 order by classsort desc"
rs.open sqlstr,conn,1,3
n=1
do while not rs.eof
t[n]=rs("classname")
n=n+1
rs.movenext
loop
rs.Close
Set rs=NotHing
%>
<%=t1%>
</body>
我就是想实现这样一个功能,从数据库读取数据,然后附值给 t1,t2 这样,但是不行
t[n]这样写不对啊,求高手解答
你的数组有定义吗?需要dim t() redim t(a) '意思是定义一个数组维数,如果你知道你的rs记录数的话,可以直接这样定义dim t(100),你的记录数应该要小于100。
n=0
do while not rs.eof
t(n)=rs("classname")
n=n+1
rs.movenext
loop
rs.Close
Set rs=NotHing
%>
<%=t(1)%>
zhu=request.form("zu")strsql="select * from member where zu=" & zu & " order by zu desc"RS.open csql,conn,1,1RSCount = RS.RecordCount '--记录总数RS.Response.write "记录总数:" & RSCount & "<BR>"IF RSCount > 0 Then do while Not RS.EOF Response.write RS("member") & "<br>" RS.MoveNext LoopEnd IFRS.close
使用数组不行吗?
dim t()
n=rs.recordcount
redim t(n)
for i=1 to rs.recordcount-1
t(i)=rs("classname")
rs.movenext
next