一维数组:
<!--#include file="conn.asp"-->
<%
dim a(2)
dim i
i=0
set rs=conn.execute("select *from forum")
do while not rs.eof
a(i)="<item><id>"&rs("userhome")&"</id></item>"
i=i+1
rs.movenext
loop%>
<%response.write i&"<br>"%>
<%for j=0 to i-1%>
<%response.write a(j)&"<br>"%>
<%next%>
<%
dim B
B=array ("1","2","3")
response.write B(2)
%>
二维数组:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<!--#include file="conn.asp"-->
<%
dim a(2,1)
set rs=server.CreateObject("adodb.recordset")
rs.open "select *from forum",conn,1,1
for i=0 to rs.recordcount-1
a(i,0)=rs("id")
a(i,1)=rs("userhome")
rs.movenext
next
%>
<%
for j=0 to 2
response.write a(j,0)
response.write a(j,1)
next
%>
</body>
</html>