public bool UpdateData(StatusMobil baru, string id_status) { Boolean stat = false; try { terhubung.Open(); cmd = new MySqlCommand(); cmd.Connection = terhubung; cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE tipe SET tipe='" + baru.Nm_status + "' WHERE id_tipe='" + id_status + "'"; cmd.ExecuteNonQuery(); stat = true; Notif("Data Berhasil Diubah", Alert.alertTypeEnum.Success); terhubung.Close(); } catch (MySqlException) { Notif("Data Gagal Diubah", Alert.alertTypeEnum.Error); } return(stat); }
public bool InsertData(StatusMobil baru) { Boolean stat = false; try { terhubung.Open(); cmd = new MySqlCommand(); cmd.Connection = terhubung; cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO tipe (tipe) VALUES ('" + baru.Nm_status + "')"; cmd.ExecuteNonQuery(); stat = true; Notif("Data Berhasil Ditambahkan", Alert.alertTypeEnum.Success); terhubung.Close(); } catch (MySqlException) { Notif("Data Gagal Ditambahkan", Alert.alertTypeEnum.Error); } return(stat); }