private void frmcourse_Load(object sender, EventArgs e) { conn cn = new conn(); string query = ""; query = "SELECT * FROM lecturer ORDER BY lecturer_Name ASC"; if (cn.openConnection() == true) { MySqlCommand cmd = new MySqlCommand(query, cn.connect); MySqlDataReader dataReader = cmd.ExecuteReader(); this.cbolname.Items.Clear(); while (dataReader.Read()) { this.cbolname.Items.Add(dataReader["lecturer_Name"].ToString()); } } cn.CloseConnection(); }
private void frmprogramme_Load(object sender, System.EventArgs e) { conn cn = new conn(); string query = ""; query = "SELECT * FROM department ORDER BY department_ID ASC"; if (cn.openConnection() == true) { MySqlCommand cmd = new MySqlCommand(query, cn.connect); MySqlDataReader dataReader = cmd.ExecuteReader(); this.cbodpt.Items.Clear(); while (dataReader.Read()) { this.cbodpt.Items.Add(dataReader["department_ID"].ToString()); } } cn.CloseConnection(); }
private void groupBox1_Enter(object sender, EventArgs e) { conn cn = new conn(); string query6 = ""; query6 = "SELECT * FROM programme ORDER BY programme_ID ASC"; if (cn.openConnection() == true) { MySqlCommand cmd = new MySqlCommand(query6, cn.connect); MySqlDataReader dataReader = cmd.ExecuteReader(); this.cbopid.Items.Clear(); while (dataReader.Read()) { this.cbopid.Items.Add(dataReader["programme_ID"].ToString()); } } cn.CloseConnection(); }
private void frmdepartment_Load(object sender, EventArgs e) { //COMBOBOX POPULATING DATA FROM DATABASE conn cn = new conn(); string query = ""; query = "SELECT * FROM faculty ORDER BY faculty_ID ASC"; if (cn.openConnection() == true) { MySqlCommand cmd = new MySqlCommand(query, cn.connect); cmd.ExecuteNonQuery(); this.cboSchoolID.Items.Clear(); /* while (dataReader.Read()) * { * this.cboSchoolID.Items.Add(dataReader["faculty_ID"].ToString()); * }*/ } cn.CloseConnection(); }