<%@ Register TagPrefix="Title" TagName="TitleShow" Src="/aspnetdata/Title.ascx" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Web" %>
<html>
<head>
    <script language="VB" runat="server">
	Dim NowConn as OleDbConnection
	dim DS as DataSet =new DataSet()
	sub Page_Load(sender as object,e as EventArgs)
		dim x as string=Request.PhysicalPath '取得路径及文件名
                dim u as string =x.Remove(x.Length-12,12)
                dim h as string="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + u + "post.mdb"
		NowConn = new OleDbConnection(h)
		if IsPostBack=false then
			dim NCom as OleDbDataAdapter = new OleDbDataAdapter("select * from city order by CityID", NowConn)
			NCom.Fill(DS, "City")
			AllCity.DataSource=DS.Tables("City").DefaultView
			AllCity.DataTextField="CityName"
			AllCity.DataValueField="CityID"
			AllCity.DataBind()'执行结合
		end if
	end sub
	sub showZipCode(sender as object,e as EventArgs)
		dim nr as TableRow
		nr=new TableRow()
		dim nc as TableCell
		nc=new TableCell()
		nc.Text="乡镇区名称"
		nr.Cells.Add(nc)
		nc = new TableCell()
		nc.Text="邮递区号"
		nr.Cells.Add(nc)
		Zip.Rows.Add(nr)
		dim NComm1 as OleDbDataAdapter = new OleDbDataAdapter("select * from CITYAREA where CityID = " + AllCity.SelectedItem.Value + " order by ZIPCode", NowConn)
		NComm1.Fill(DS, "CITYAREA")
		dim i as integer =0
		for i=0 to DS.Tables("CITYAREA").Rows.Count-1
			nr = new TableRow()
			nc = new TableCell()
			nc.Text = DS.Tables("CITYAREA").Rows(i)("CityAreaName").ToString()
			nr.Cells.Add(nc)
			nc = new TableCell()
			nc.Text = DS.Tables("CITYAREA").Rows(i)("ZIPCode").ToString()
			nr.Cells.Add(nc)
			Zip.Rows.Add(nr)
		next
	end sub
    </script>
</head>
<body background="/aspnetdata/images/winback.gif">
<Title:TitleShow id="BookT" Runat="server" />
    <form runat="server">
<ASP:LABEL id="rr" runat="server" />
请选择县市：<asp:dropdownlist AutoPostBack="True" id="AllCity" OnSelectedIndexChanged="showZipCode"
runat="server" />
<asp:Table id="Zip" Font-Name="Verdana" Font-Size="10pt" CellPadding=3 CellSpacing=1 BorderColor="Red" BorderWidth="1" Gridlines="Both" runat="server"/>


</form>