public static bool Delete(int id) { string updateQuery = @"DELETE FROM biaya_parkir WHERE id_kendaraan = @id_kendaraan"; var cmd = new MySqlCommand(updateQuery, new MySqlConnection(DatabaseUtility.ConnectionString)); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@id_kendaraan", id); return(DatabaseUtility.ExecuteCommandNonQuery(cmd)); }
public static bool Insert(string jenisKendaraan, int tarif) { string updateQuery = @"INSERT INTO biaya_parkir(jenis_kendaraan, Tarif) VALUES (@jenis_kendaraan, @tarif)"; var cmd = new MySqlCommand(updateQuery, new MySqlConnection(DatabaseUtility.ConnectionString)); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@jenis_kendaraan", jenisKendaraan); cmd.Parameters.AddWithValue("@tarif", tarif); return(DatabaseUtility.ExecuteCommandNonQuery(cmd)); }
public static void UpdateData3(string x, string y) { string updateQuery = @"UPDATE db_parkir.parkir_masuk a join biaya_parkir b SET a.tanggal_keluar = CURDATE(), a.jam_keluar = curtime(),a.Tarif = b.Tarif WHERE a.no_masuk = '" + int.Parse(x) + "' or a.no_kendaraan= '" + y + "'"; var cmd = new MySqlCommand(updateQuery, new MySqlConnection(DatabaseUtility.ConnectionString)); cmd.CommandType = CommandType.Text; //cmd.Parameters.AddWithValue("@x", int.Parse(x)); DatabaseUtility.ExecuteCommandNonQuery(cmd); }
public static bool Update(int id, string jenisKendaraan, int tarif) { string updateQuery = @"UPDATE biaya_parkir SET jenis_kendaraan = @jenis_kendaraan,Tarif = @tarif WHERE id_kendaraan = @id_kendaraan"; var cmd = new MySqlCommand(updateQuery, new MySqlConnection(DatabaseUtility.ConnectionString)); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@id_kendaraan", id); cmd.Parameters.AddWithValue("@jenis_kendaraan", jenisKendaraan); cmd.Parameters.AddWithValue("@tarif", tarif); return(DatabaseUtility.ExecuteCommandNonQuery(cmd)); }
public static bool Insert(string username, string password, string nama, string alamat, string No_Hp, string privillage) { string updateQuery = @"INSERT INTO login(username,password,nama,alamat,No_Hp,Privillage) VALUES (@username,@password,@nama,@alamat,@No_Hp,@privillage)"; var cmd = new MySqlCommand(updateQuery, new MySqlConnection(DatabaseUtility.ConnectionString)); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@password", password); cmd.Parameters.AddWithValue("@nama", nama); cmd.Parameters.AddWithValue("@alamat", alamat); cmd.Parameters.AddWithValue("@No_Hp", No_Hp); cmd.Parameters.AddWithValue("@privillage", privillage); return(DatabaseUtility.ExecuteCommandNonQuery(cmd)); }