<html>
<head>
<title></title>
<script language="javascript">
function abselect_change(Val)
{
self.location=self.location.href+"?ab="+Val;
}
</script>
</head>
<body>
<select id="abselect" onchange="abselect_change(this.options[this.selectedIndex].value);" >
<%
'省略数据库打开代码
Dim rs
Set rs=conn.Execute("select distinct ab from 表名 group by ab")'过滤重复数据
'循环输出字段ab的值
Do Until rs.EOF
Response.Write "<option value="&rs("ab")&">"&rs("ab")&"</option>"
rs.MoveNext
Loop
%>
</select>
<%
Dim rs1
'省略数据库打开代码
IF Request("ab")<>"" Then'判断是否选择了数据
Set rs1=conn.Execute("select * from 表名 where ab='"&Request("ab")&"'")
IF rs1.EOF=False Then'判断是否从数据库中读取到了数据
'以表格的形式循环输出
With Response
.Write "<table>"
Do Until rs1.EOF
.Write "<tr>"
Dim i
For i=0 To rs1.Fields.Count-1
.Write "<td>"&rs1.Fields(i).Value&"</td>
Next
.Write "</tr>"
rs1.MoveNext
Loop
.Write "</table>"
End With
End IF
End IF
%>
</body>
</html>
以上代码未测试可能运行不正确