I have a table where my constant information is stored. I want to replace the city and town names in this fixed table with city and dsitrict names that I pulled from other tables named city and district. But it is sending blank data. I could never understand why.
private void getcity()
{
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
OleDbCommand cmd = new OleDbCommand("select * from city ORDER BY id ASC", conn);
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
comboBox1.Items.Add(dr["sehir"].ToString());
comboBox1.ValueMember = (dr["id"].ToString());
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex != -1)
{
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter("select * from ilceler where city= " + comboBox1.SelectedValue, conn);
da.Fill(dt);
comboBox2.ValueMember = "id";
comboBox2.DisplayMember = "town";
comboBox2.DataSource = dt;
}
}