SHARE
TWEET

Untitled

a guest Feb 27th, 2020 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void changeName(int LånerID, String newName) throws SQLIntegrityConstraintViolationException {
  2.         String query = "UPDATE lånertabel SET Navn='"+newName+"' WHERE LånerID="+LånerID+";";
  3.         try {
  4.             Connection con = DBConnector.getConnection();
  5.             PreparedStatement ps = con.prepareStatement(query);
  6.             ps.executeUpdate();
  7.             System.out.println("Navn ændret");
  8.         } catch (SQLException ex) {
  9.             System.out.println("Fejl i connection til Database");
  10.             ex.printStackTrace();
  11.         }
  12.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top