private void GetForm1() { connection conn = new connection(); if (conn.OpenConnection() == true) { string query = "select * FROM staff"; MySqlCommand cmd = new MySqlCommand(query, conn.con); MySqlDataReader DataReader = cmd.ExecuteReader(); conn.CloseConnection(); } }
private void GetStaff() { connection connect = new connection(); if (connect.OpenConnection() == true) { String query = "SELECT * FROM role ORDER BY Role_id ASC"; MySqlCommand cmd = new MySqlCommand(query, connect.con); MySqlDataReader dataReader = cmd.ExecuteReader(); //Read the data and store them in the list this.cboRole.Items.Clear(); while (dataReader.Read()) { if (dataReader["Role_Name"].ToString().Replace(" ", "") != "") { this.cboRole.Items.Add(dataReader["Role_Name"].ToString()); } } connect.CloseConnection(); } }