using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.OleDb; using System.Configuration; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string connectionString, queryString; connectionString = ConfigurationManager.ConnectionStrings["ostanConnectionString"].ToString(); queryString = "SELECT FROM situation where state ='" + DropDownList1.SelectedValue + "'"; using (OleDbConnection connection = new OleDbConnection(connectionString)) { OleDbCommand command = new OleDbCommand(queryString, connection); connection.Open(); OleDbDataReader reader = command.ExecuteReader(); DropDownList2.Items.Clear(); while (reader.Read()) DropDownList2.Items.Add(reader["city"].ToString()); reader.Close(); connection.Close(); } } }
Select [column_name1],[column_name2] .... [column_name] from yourTableName WHERE condition1 and condition2 OR condition3
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)