asp从数据库传过来的值怎么绑定给下拉菜单,如图为什么二级菜单的值绑定不上呢 80
2个回答
展开全部
给你 一段代码参考
<select name="sc_id">
<option value="0">--请选择--</option>
<%
dim sqlTemp,rsTemp
set rsTemp = server.CreateObject("ADODB.recordset")
sql = "select * from school"
rs.open sql,conn,1,1
if rs.eof then
else
%>
<%
if sid <> "" then
do while not rs.eof
%>
<option value="<%=rs("sc_id")%>"><%=rs("schoolname")%></option>
<%
rs.movenext
loop
else
do while not rs.eof
%>
<option value="<%=rs("sc_id")%>"><%=rs("schoolname")%></option>
<%
rs.movenext
loop
end if
end if
rs.close
%>
</select>
<select name="sc_id">
<option value="0">--请选择--</option>
<%
dim sqlTemp,rsTemp
set rsTemp = server.CreateObject("ADODB.recordset")
sql = "select * from school"
rs.open sql,conn,1,1
if rs.eof then
else
%>
<%
if sid <> "" then
do while not rs.eof
%>
<option value="<%=rs("sc_id")%>"><%=rs("schoolname")%></option>
<%
rs.movenext
loop
else
do while not rs.eof
%>
<option value="<%=rs("sc_id")%>"><%=rs("schoolname")%></option>
<%
rs.movenext
loop
end if
end if
rs.close
%>
</select>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询