<%@ LANGUAGE="VBScript" %>
<%
	'**************************************************************************
	'* Given a ZIP code, returns a text file containing the matching city and
	'* state.
	'**************************************************************************

	'Buffer output.
	Response.Buffer = true

 	'Set response Content-type header.
	Response.ContentType = "text/plain"

	'Open the database connection.
	dbq = Server.MapPath("data/ZipCodes.mdb")
	set conn = Server.CreateObject("ADODB.Connection")
	conn.Open "DBQ=" & dbq &  ";DRIVER={Microsoft Access Driver (*.mdb)};"

	'Look up the given ZIP code.
	sql = "select * from ZipCodes where ZipCode = '" & Request("zipCode") & "'"
	set rs = conn.Execute(sql)

	'Display the matching city and state, if found.
	if not (rs.BOF and rs.EOF) then
		Response.Write(rs.Fields("City") & "," & rs.Fields("State"))
	end if
%>