diff --git a/out/production/IDB-Hue-Projekt/Löschen.class b/out/production/IDB-Hue-Projekt/Löschen.class index ab6cf82..fcb9e2f 100644 Binary files a/out/production/IDB-Hue-Projekt/Löschen.class and b/out/production/IDB-Hue-Projekt/Löschen.class differ diff --git a/src/Hinzufügen.java b/src/Hinzufügen.java index 0ecb70e..c45d9e2 100644 --- a/src/Hinzufügen.java +++ b/src/Hinzufügen.java @@ -2,6 +2,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; + import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; public class Hinzufügen extends Dialog implements ActionListener { @@ -15,8 +16,8 @@ public class Hinzufügen extends Dialog implements ActionListener { Font font = new Font("Arial", Font.PLAIN, 12); - public Hinzufügen(ResultSet r, String tab, JFrame owner,boolean modal) { - super(owner,modal); + public Hinzufügen(ResultSet r, String tab, JFrame owner, boolean modal) { + super(owner, modal); this.setSize(500, 600); @@ -61,25 +62,24 @@ public class Hinzufügen extends Dialog implements ActionListener { for (int i = 1; i < z; i++) { try { if (i == z - 1) { - spalten = spalten + "'" + b[i].getText() + "'"; - sname = sname + rm.getColumnName(i + 1); + if (b[i].getText().length() == 0) { + int response = JOptionPane.showConfirmDialog(null, "Soll der Wert für " + rm.getColumnName(i + 1) + " 'NULL' übernommen werden?", "Bestätigen", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + System.out.println(response); + if (response == 0) { + spalten = spalten + " Null"; + sname = sname + rm.getColumnName(i + 1); + } else { + einf.setAction(null); + } + } else { + spalten = spalten + "'" + b[i].getText() + "'"; + sname = sname + rm.getColumnName(i + 1); + } } else { spalten = spalten + "'" + b[i].getText() + "',"; sname = sname + rm.getColumnName(i + 1) + ","; } System.out.println(b[i].getText()); - if (b[i].getText().length() == 0) { - int response = JOptionPane.showConfirmDialog(null, "Soll der Wert für " + rm.getColumnName(i + 1) + " 'NULL' übernommen werden?", "Bestätigen", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - System.out.println(response); - if (response == 0) { - spalten= spalten+" Null"; - } else { - break; - } - } - - - } catch (Exception ex) { throw new RuntimeException(ex); diff --git a/src/Löschen.java b/src/Löschen.java index 37bb40a..c8d33b1 100644 --- a/src/Löschen.java +++ b/src/Löschen.java @@ -14,6 +14,7 @@ public class Löschen { if (response == 0) { try (Connection conn = DriverManager.getConnection(url, "root", "")) { Statement s = conn.createStatement(); + //SELECT *, CURRENT_TIMESTAMP FROM spiel WHERE spiel.Heim =1 or spiel.Gast =1 AND spiel.Spiel_ID NOT IN (SELECT b.Spiel_ID FROM bundesliga_archiv.spiel as b); ResultSet r = s.executeQuery("INSERT into bundesliga_archiv.verein SELECT * ,CURRENT_TIMESTAMP FROM `verein` WHERE V_ID = " + Einzelansicht.vid); r = s.executeQuery("DELETE From " + tab + " WHERE " + model.getColumnName(0) + "=" + Einzelansicht.vid);