Advertisement
Guest User

Untitled

a guest
Dec 18th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. @Override
  2. public void toevoegenLid(Lid lid) throws DBException, SQLException {
  3. if (lid != null) {
  4. try (Connection conn = ConnectionManager.getConnection();) {
  5. try (PreparedStatement stmt = conn.prepareStatement(
  6. "insert into Lid(rijksregisternummer"
  7. + " , voornaam"
  8. + " , naam"
  9. + " , geslacht"
  10. + " , telnr"
  11. + " , emailadres"
  12. + " , start_lidmaatschap"
  13. + " , opmerkingen"
  14. + " ) values(?,?,?,?,?,?,?,?)"
  15. )) {
  16. stmt.setString(1, lid.getRijksregisternummer());
  17. stmt.setString(2, lid.getVoornaam());
  18. stmt.setString(3, lid.getNaam());
  19. stmt.setString(4, valueOf(lid.getGeslacht()));
  20. stmt.setString(5, lid.getTelnr());
  21. stmt.setString(6, lid.getEmailadres());
  22. stmt.setDate(7, valueOf(LocalDate.now()));
  23. stmt.setString(8, lid.getOpmerkingen());
  24. stmt.execute();
  25. } catch (SQLException sqlEx) {
  26. throw new DBException("SQL-exception in toevoegenLid "
  27. + "- statement" + sqlEx);
  28. }
  29. } catch (SQLException sqlEx) {
  30. throw new DBException("SQL-exception in toevoegenLid "
  31. + "- connection" + sqlEx);
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement