asp下拉列表框 怎么读取数据库中的数据
展开全部
<SELECT name=select1 size=1 style="width:300px">
<%
sqltext="select * from depart"
Set rs1 = Server.CreateObject("ADODB.RecordSet")
DnsText = "Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=E:\new\db2.mdb" '"UID=;PWD=;DSN=1"
Rs1.Open SqlText, DnsText,3,1
Do While Not rs1.Eof
k=rs1.fields(i)
%>
<option value="<%=k%>"><%=k%>
<%
rs1.MoveNext
Loop
%>
</select>
<%
sqltext="select * from depart"
Set rs1 = Server.CreateObject("ADODB.RecordSet")
DnsText = "Provider=Microsoft.Jet.OLEDB.4.0;Da
ta Source=E:\new\db2.mdb" '"UID=;PWD=;DSN=1"
Rs1.Open SqlText, DnsText,3,1
Do While Not rs1.Eof
k=rs1.fields(i)
%>
<option value="<%=k%>"><%=k%>
<%
rs1.MoveNext
Loop
%>
</select>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询