1个回答
展开全部
response.write "<select class='nnn' onchange='js_hanshu()' name='nnn'>"
response.write " <option value='请选择'>请选择</option>"
set rs=server.createobject("adodb.recordset")
sql="select * from KS where title like '%关键字%'"
rs.open sql,conn,1,1
if rs.bof and rs.eof then
response.write ""
else
do while not rs.eof
response.write "<option value='"&rs("title")&"'>"&rs("title")&"</option>"
rs.movenext
loop
end if
rs.close:set rs=nothing
response.write "</select>"
追答
这不是asp,这是asp.net
例如表table里的列month最后10条
String ConnectionString = "Data Source=.;Initial Catalog=XXXX;Integrated Security=True";
SqlConnection Connection=new SqlConnection(ConnectionString);//声明数据库链接
SqlString="select top 10 from table order by month desc";//查询语句
DataSet dataset = new DataSet();//声明数据集
Connection.Open();打开数据库
SqlDataAdapter adapter = new SqlDataAdapter(SqlString, Connection);
adapter.Fill(dataset);//读取数据放入数据集
Connection.Close();//关闭数据库
DataTable dt=dataset.Tables[0];从数据集中取出表
combobox-item.DataSource = dt;//下拉列表绑定查询的10条的数据表
combobox-item.DisplayMember = "month";//设置下拉显示的是month行的值
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询