private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { string cmd = @"select * from seat where hallid = :id"; adapter = new OracleDataAdapter(cmd, connString); adapter.SelectCommand.Parameters.Add("id", HallIDs.ElementAt(comboBox2.SelectedIndex)); ds = new DataSet(); adapter.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; }
//function to get hall id and name into comboboxes public void getAllHallId_Name() { HallIDs.Clear(); OracleCommand c = new OracleCommand(); c.Connection = conn; c.CommandText = "select HALLID , hallname from hall "; c.CommandType = CommandType.Text; OracleDataReader dr = c.ExecuteReader(); while (dr.Read()) { HallIDs.Add(int.Parse(dr[0].ToString())); comboBoxH_id.Items.Add(dr[0]); comboBox3.Items.Add(dr[1]); } dr.Close(); }