From a8f57cbaa9ee01ce4e84f671c9f7bd66203f065e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=B8=85?= <3309605189@qq.com> Date: Wed, 25 May 2022 00:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\347\273\203\344\271\2403.md" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "\347\216\213\345\270\205/\347\273\203\344\271\2403.md" 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 0000000..dea4c4b --- /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 -- Gitee