Guest User

Untitled

a guest
Jan 12th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. Altas MySQL/NetBeans
  2.  try{
  3.             Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/tutorial","root","1234");
  4.             Statement stmt = (Statement) con.createStatement();
  5.          
  6.            
  7.             String nom = jTextField1.getText();
  8.             String ap1 = jTextField2.getText();
  9.             String ap2 = jTextField3.getText();
  10.            
  11.            
  12.             String Insert = "INSERT INTO example VALUES ('" +nom+ "','"+ap1+"','"+ap2+"')";
  13.            
  14.             stmt.executeUpdate(Insert);
  15.             jLabel5.setText("Información guardada.");
  16.             jLabel5.setForeground(Color.green);
  17.            
  18.         }catch(Exception e){
  19.             jLabel5.setText("Ah ocurrido un error.");
  20.             jLabel5.setForeground(Color.red);
  21.         }
Add Comment
Please, Sign In to add comment