喜帖街免费下载:ASP中如和动态增长select下拉菜单的内容?

来源:百度文库 编辑:高校问答 时间:2024/04/28 03:18:54
请教给为高手,如何从数据库中获得相关的值让其显示在 select菜单中?

<select name="A">
<%do while not rs.EOF%>
<option value="<%=rs(ID)%>"><%=rs("Name")%></option>
<%rs.MoveNext:Loop%>
</select>

<select>
<%
set rs = conn.execute("Select * from [table]")
while not rs.eof
response.write "<option></option>"
rs.movenext
wend
set rs = nothing
%>
</select>

在select里面做一个循环
<%do while not rs.eof%>
<option value=<%=rs("字段")%>>
<%loop%>

<select name="A">
<%do while not rs.EOF%>
<option value="<%=rs(ID)%>"><%=rs("Name")%></option>
<%rs.MoveNext:Loop%>
</select>
正确的