asp 代码 读取ID

来源:百度知道 编辑:UC知道 时间:2024/06/14 21:05:24
下面是一段滚动图片代码,我想从数据库表tupian里读取ID1的图片作为滚动图片001.gif,读取ID2的图片作为滚动图片002.gif,读取ID3的图片作为滚动图片003.gif,如此类推,请问我该怎样做才行?

<div id="demo" style="overflow:hidden;height:210;width:560;color:#ffffff">
<table align="left" cellpadding="0" cellspace="0" border="0">
<tr>
<td id="demo1" valign="top"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="indexgd/001.gif" width="143" height="200" /></td>
<td><img src="indexgd/002.gif" width="143" height="200" /></td>
<td><img src="indexgd/003.gif" width="143" height="200"

在script里定义一个数组,然后利用下面的语句赋值
<%
Set Rs = Server.createobject("adodb.recordset")
Rs.Open "Select * From tupian",Conn,3,1
for i=0 to Rs.RecordCount
%>
arr[i]=<%=Rs(pic)%>
<%
Rs.moveNext
if Rs.Eof Then Exit For
Next
Rs.Close
Set Rs = Nothing
%>

<td><img src="<%=rs3("pic")%>" width="143" height="200" /></td>
只需要这一句就可以了,其他的都去掉

........
if rs3.eof then
response.write("")
else
do while not rs3.eof 'for i=1 to 10
response.write("<td><img src='"<%=rs3("pic")%>"' width='"143"' height='"200"' /></td>")
rs3.movenext
loop 'next
end if

<td><img src="<%=rs3("pic")%>" width="143" height="200" />&l