MySqlConnection con; con = new MySqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString()); con.Open(); try { for (int i = 0; i < CblistCountry.Items.Count; i++) { if (CblistCountry.Items[i].Selected) { string var = string.Empty; var += CblistCountry.Items[i].Value.ToString(); string str = "SELECT * FROM add_state where COUNTRYID='" + var + "'"; MySqlCommand cmd; cmd = new MySqlCommand(str, con); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { CblistState.DataSource = ds; CblistState.DataTextField = "StateName"; CblistState.DataValueField = "StateID"; CblistState.DataBind(); } } } } catch { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)