これを試して...
aspx ページ:
<body>
<form runat="server">
<asp:DropDownList runat="server" ID="ddlDb" AutoPostBack="True" OnSelectedIndexChanged="ddlDb_SelectedIndexChanged">
<asp:ListItem Text="-- Select --" Value=""></asp:ListItem>
<asp:ListItem Text="Students" Value="Students"></asp:ListItem>
<asp:ListItem Text="Classes" Value="Classes"></asp:ListItem>
</asp:DropDownList>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</form>
</body>
aspx.cs:
protected void ddlDb_SelectedIndexChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(ddlDb.SelectedValue))
{
var dbPath = Server.MapPath(@"\App_Data\Database1.mdf");
var scon = "Data Source=.\\SQLEXPRESS;AttachDbFilename='" + dbPath + "';Integrated Security=True;User Instance=True";
var cmd = "select * from " + ddlDb.SelectedValue;
var dt = new DataTable();
var da = new SqlDataAdapter(cmd, scon);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}