public void HapusGaya(Gaya gayaHapus) { try { connection.Open(); string query = string.Format("delete from `gaya` where id_gaya={0}", gayaHapus.IdGaya); MySqlCommand command = new MySqlCommand(query, connection); command.ExecuteNonQuery(); connection.Close(); } catch (Exception e) { MessageBox.Show("Error Deleting Gaya Renang!\nKeterangan :" + e.Message); } }
public void InsertGaya(Gaya gayaInput) { try { connection.Open(); string query = string.Format("insert into `gaya`(nama_gaya) values('{0}')", gayaInput.NamaGaya); MySqlCommand command = new MySqlCommand(query, connection); command.ExecuteNonQuery(); connection.Close(); } catch (Exception e) { MessageBox.Show("Error Inserting Gaya Renang!\nKeterangan :" + e.Message); } }