% db_path = "zipcode.mdb" Set conn= Server.CreateObject("ADODB.Connection") connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Server.MapPath(db_path) conn.Open connstr %> |
!--#include file="conn.asp" --> % if request.form("submit")="search" then whatzip=request.form("zipcode") Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select * from zip where zipcode like '%"whatzip"%' " rs.Open sql,conn,1,1 %> % if rs.EOF and rs.BOF then response.write ("未能查到") else Do Until rs.EOF response.write("hr>该地址是:" rs("placename")rs("zipcode")) response.write("br>所在省份是:" rs("province")) rs.MoveNext Loop end if %> br>a href="search.asp">again/a> % rs.close Set rs = Nothing conn.close set conn=Nothing else %> form action="search.asp" method="post"> input type="text" name="zipcode"> input type="submit" name="submit" value="search"> /form> %end if%> |