-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateBand.java
29 lines (23 loc) · 990 Bytes
/
UpdateBand.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class UpdateBand {
static void updateBand() throws SQLException {
String bandIdString = JOptionPane.showInputDialog(null, "Type the band's id to update");
int bandId = Integer.parseInt(bandIdString);
String optionString = JOptionPane.showInputDialog(null, "What do you want to update\n\n 1) Name\n 2) Year of formation");
int option = Integer.parseInt(optionString);
String newValue = JOptionPane.showInputDialog(null, "Type the new value");
BandDao bandDao = new BandDao();
switch(option){
case 1:
bandDao.update(bandId, "band_name", newValue);
break;
case 2:
bandDao.update(bandId, "band_birth", newValue);
break;
default:
JOptionPane.showMessageDialog(null, "Type a valid option");
}
Main.menu();
}
}