diff --git "a/\347\216\213\345\270\205/\347\273\203\344\271\2403.md" "b/\347\216\213\345\270\205/\347\273\203\344\271\2403.md" new file mode 100644 index 0000000000000000000000000000000000000000..dea4c4b7956fe4d649db1f7bd1f2d8e3653fc768 --- /dev/null +++ "b/\347\216\213\345\270\205/\347\273\203\344\271\2403.md" @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) { + SqlDataSource1.SelectCommand = "select * from city where type=1 "; + SqlDataSource2.SelectCommand = "select * from city where type=2 and pid=2"; + SqlDataSource3.SelectCommand = "select * from city where type=3 and pid in (select id from city where type = 2 and pid = 2)"; + } + + } + + protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) + { + + SqlDataSource2.SelectCommand = "select * from city where type=2 and pid=" + DropDownList1.SelectedValue; + + SqlDataSource3.SelectCommand = "select * from city where type=3 and pid in "(select id from city where type = 2 and pid = " + DropDownList1.SelectedValue+")"; + } + + protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) + { + + SqlDataSource3.SelectCommand = "select * from city where type=3 and pid =" + DropDownList2.SelectedValue; + + } + } +} \ No newline at end of file