Guest User

Untitled

a guest
Feb 8th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. String a,b,c,f;
  2. int d,e;
  3. a = jTextField1.getText();
  4. b = jTextField2.getText();
  5. c = jTextField3.getText();
  6. d = Integer.parseInt(jTextField4.getText());
  7. e = Integer.parseInt(jTextField5.getText());
  8. f = jTextField6.getText();
  9.  
  10. try {
  11. Class.forName("java.mysql.DriverManager");
  12. Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/dash","root","root");
  13. Statement stmt = (Statement) con.createStatement();
  14. stmt.executeUpdate("insert into growth values('"+a+"','"+b+"','"+c+"','"+d+"','"+e+"','"+f+"',);");
  15.  
  16. JOptionPane.showMessageDialog(this," record added");
  17.  
  18.  
  19.  
  20.  
  21.  
  22. } catch (ClassNotFoundException | SQLException ex) {
  23. Logger.getLogger(cnnect1.class.getName()).log(Level.SEVERE, null, ex);
  24. }
Add Comment
Please, Sign In to add comment