Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Altas MySQL/NetBeans
- try{
- Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/tutorial","root","1234");
- Statement stmt = (Statement) con.createStatement();
- String nom = jTextField1.getText();
- String ap1 = jTextField2.getText();
- String ap2 = jTextField3.getText();
- String Insert = "INSERT INTO example VALUES ('" +nom+ "','"+ap1+"','"+ap2+"')";
- stmt.executeUpdate(Insert);
- jLabel5.setText("Información guardada.");
- jLabel5.setForeground(Color.green);
- }catch(Exception e){
- jLabel5.setText("Ah ocurrido un error.");
- jLabel5.setForeground(Color.red);
- }
Add Comment
Please, Sign In to add comment