Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void toevoegenLid(Lid lid) throws DBException, SQLException {
- if (lid != null) {
- try (Connection conn = ConnectionManager.getConnection();) {
- try (PreparedStatement stmt = conn.prepareStatement(
- "insert into Lid(rijksregisternummer"
- + " , voornaam"
- + " , naam"
- + " , geslacht"
- + " , telnr"
- + " , emailadres"
- + " , start_lidmaatschap"
- + " , opmerkingen"
- + " ) values(?,?,?,?,?,?,?,?)"
- )) {
- stmt.setString(1, lid.getRijksregisternummer());
- stmt.setString(2, lid.getVoornaam());
- stmt.setString(3, lid.getNaam());
- stmt.setString(4, valueOf(lid.getGeslacht()));
- stmt.setString(5, lid.getTelnr());
- stmt.setString(6, lid.getEmailadres());
- stmt.setDate(7, valueOf(LocalDate.now()));
- stmt.setString(8, lid.getOpmerkingen());
- stmt.execute();
- } catch (SQLException sqlEx) {
- throw new DBException("SQL-exception in toevoegenLid "
- + "- statement" + sqlEx);
- }
- } catch (SQLException sqlEx) {
- throw new DBException("SQL-exception in toevoegenLid "
- + "- connection" + sqlEx);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement