<%@ Register TagPrefix="Title" TagName="TitleShow" Src="/aspnetdata/Title.ascx" %>
<%@Page Debug=True %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.sqlclient" %>
<html>
<head>
	<script language="VB" runat="server">
	Sub Btn_Click(sender As Object, e As EventArgs) 
	dim nowdsn as Hashtable = Ctype(ConfigurationSettings.GetConfig("dataLink"),Hashtable)
	dim x as string = AllTables.SelectedItem.Text
	dim y as string = nowdsn(x).ToString()
	dim NowConn as SqlConnection = new SqlConnection(nowdsn("northwind").ToString())
	Dim re as SqlDataAdapter = new SqlDataAdapter(y, NowConn)
	Dim ds as DataSet = new DataSet()
	re.Fill(ds, x)
	DataShow.DataSource = ds.Tables(x).DefaultView
	DataShow.DataBind()
	end sub
	</script>
</head>
<body background="/aspnetdata/images/winback.gif">
<Title:TitleShow id="BookT" Runat="server" />
<form runat="server">
请指定欲打开的数据表：
        <asp:DropDownList id="AllTables" runat="server">
            <asp:ListItem>Customers</asp:ListItem>
            <asp:ListItem>Orders</asp:ListItem>
            <asp:ListItem>Employees</asp:ListItem>
            <asp:ListItem>Products</asp:ListItem>
        </asp:DropDownList>
<asp:button id="b1" text="确定" OnClick="Btn_Click" runat="server"/>
      <ASP:DataGrid id="DataShow" runat="server"
        BorderColor="black"
        BorderWidth="1"
        GridLines="Both"
        CellPadding="3"
        CellSpacing="0"
        Font-Name="Verdana"
        Font-Size="8pt"
        HeaderStyle-BackColor="#aaaadd"
      />
</form>
</body>
