邦定数据方法一 dbconnection conn = new dbconnection(); DataTable dt_game = new DataTable(); string sql_game = " SELECT GamesID,CName,Season,type FROM Games_Info order by Cname " ; dt_game = conn.ExecuteSelectTable(sql_game); ListItem first_Item = new ListItem(); first_Item.Value = " 0 " ; first_Item.Text = "" ; GamesID.Items.Add(first_Item); // MatchID.Items.Add(first_Item); foreach (DataRow dr in dt_game.Rows) ... { ListItem li_game = new ListItem(); li_game.Text = dr["CName"].ToString(); li_game.Value = dr["GamesID"].ToString(); GamesID.Items.Add(li_game); } 方法二 // *****填充nationid(dropdownlist)的选项 string sql = " SELECT * FROM Nations_Info order by CName " ; dbconnection conn = new dbconnection(); DataTable dt = new DataTable(); dt = conn.ExecuteSelectTable(sql); nationid.DataSource = dt.DefaultView; nationid.DataTextField = " CName " ; // dropdownlist的Text的字段 nationid.DataValueField = " NationID " ; // dropdownlist的Value的字段 nationid.DataBind(); 取得他选项的value protected void GamesID_SelectedIndexChanged( object sender, EventArgs e) ... { dbconnection conn = new dbconnection(); DataTable dt_match = new DataTable(); string sql_match = "select m.MatchID,t1.CName as HomeTeamCName,t2.CName as AwayTeamCname,m.StartTime from Matchs_Info m inner join Teams_Info t1 on m.HomeTeamID = t1.TeamID inner join Teams_Info t2 on m.AwayTeamID = t2.TeamID where m.flag=3 and m.GamesID= " + GamesID.SelectedValue.ToString() + " order by m.matchid desc"; dt_match = conn.ExecuteSelectTable(sql_match); foreach (DataRow dr in dt_match.Rows) ...{ ListItem li_match = new ListItem(); li_match.Text = dr["HomeTeamCName"].ToString() + " VS " + dr["AwayTeamCname"].ToString() + dr["StartTime"].ToString(); li_match.Value = dr["matchid"].ToString(); MatchID.Items.Add(li_match); } } //在他的SelectedIndexChanged(事件(双击控件即可),取得gameid选择的value为 GamesID.SelectedValue.ToString()