Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public static void setPersoonDAO(Persoon p) throws SQLException {
  2. Connection con = LoadDriver.getConnection();
  3. PreparedStatement ps = null;
  4.  
  5. ps = con.prepareStatement("INSERT INTO Persoon VALUES (?,?)");
  6. ps.setString(1, p.getNaam());
  7. ps.setInt(2, p.getLeeftijd());
  8.  
  9.  
  10. ps.executeUpdate(); //uitvoeren
  11.  
  12. con.commit(); //insert is manipulation dus committen verplicht
  13.  
  14. con.close(); // altijd closen na actie
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement