教程之家 TIY Editor
教程之家
改变方向
暗黑模式
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open(Server.Mappath("/db/northwind.mdb")) set rs=Server.CreateObject("ADODB.recordset") sql="SELECT DISTINCT Country FROM Customers ORDER BY Country" rs.Open sql,conn country=request.form("country") %>
Choose Country
<% do until rs.EOF response.write("
") response.write(rs.fields("Country")) rs.MoveNext loop rs.Close set rs=Nothing %>
<% if country<>"" then sql="SELECT Companyname,Contactname,Country FROM Customers WHERE country='" & country & "'" set rs=Server.CreateObject("ADODB.Recordset") rs.Open sql,conn %>
Companyname
Contactname
Country
<% do until rs.EOF response.write("
") response.write("
" & rs.fields("companyname") & "
") response.write("
" & rs.fields("contactname") & "
") response.write("
" & rs.fields("country") & "
") response.write("
") rs.MoveNext loop rs.close conn.Close set rs=Nothing set conn=Nothing%>
<% end if %>