日期:2014-05-17  浏览次数:20748 次

求从数据库读数据到下拉框中代码!!!!!!
表:data
字段:style

代码越全越好     我初学者

------解决方案--------------------
set rs=server.CreateObject( "adodb.recordset ")
sql= "select style from data "
rs.open sql,conn,1,1
<select name= "link " size= "1 " style= "width:130 ">
<option value= "# "> </option>
<%
do while not rs.eof
Response.Write( " <option value= "&rs( "style ")& "> "&rs( "style ")& " </option> ")
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
------解决方案--------------------
<script language = 'vbscript '>
set Rec=server.CreateObject( "ADODB.RECORDSET ")
sql= "select style from data order by style "
Rec.open sql,conn
<select name= "opt " size= "1 " style= "width:100 ">
<option value= "# "> </option>
<%
do while not Rec.eof
Response.Write( " <option value= "&Rec( "style ")& "> "&Rec( "style ")& " </option> ")
rs.movenext
loop
Rec.close
set Rec=nothing
%>
</select>
</script>

------解决方案--------------------
连接数据库

set rs=server.CreateObject( "adodb.recordset ")
sql= "select style from data "
rs.open sql,conn,1,1
<select name= "link " size= "1 " style= "width:130 ">
<option value= "# "> </option>
<%
do while not rs.eof
Response.Write( " <option value= "&rs( "style ")& "> "&rs( "style ")& " </option> ")
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>