lasciando un attimo perdere le migliorie (che senno stiamo qua fino a domani probabilmente).
ho provato a modificare così:
codice:
public class Movimenti {
private int entrate;
private int uscite;
private String causale;
private String data;
public Movimenti(int entrate, int uscite, String causale, String data) {
this.entrate = entrate;
this.uscite = uscite;
this.causale = causale;
this.data = data;
}
....
public boolean salva() {
try {
Connection conn = DriverManager.getConnection("jdbc:mysql://62.94.208.157:3306/banca?user=root&password=qwyjkzx");
Statement stmt = conn.createStatement();
int g = stmt.executeUpdate("insert into movimenti (entrate,uscite,causale,data) values(" + this.entrate + "," + this.uscite + ",'" + this.causale + "','" + this.data + "')");
stmt.close();
return true;
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
return false;
}
}
in fase di esecuzione mi da questo errore:
codice:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:470)
at java.lang.Integer.parseInt(Integer.java:499)
at banca.Banca.jButton1MouseClicked(Banca.java:182)
at banca.Banca.access$100(Banca.java:17)
at banca.Banca$2.mouseClicked(Banca.java:73)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
at java.awt.Component.processMouseEvent(Component.java:6266)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)