Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public void addModule(String title, String description, String goals, String task, PrintWriter out){
  2.  
  3. PreparedStatement ps;
  4. //name = name;
  5.  
  6. // System.out.println("The SQL query is: " + strSelect2);
  7. // out. println("The SQL query is: " + strSelect2);
  8.  
  9. System.out.println();
  10. out.println();
  11.  
  12. try {
  13.  
  14. String ins = "insert into module(title,description,goals,task) values(?,?,?,?)";
  15.  
  16. ps = conn.prepareStatement(ins);
  17.  
  18.  
  19. ps.setString(1,title);
  20. ps.setString(2,description);
  21. ps.setString(3,goals);
  22. ps.setString(4,task);
  23.  
  24.  
  25. out.println(ps);
  26. out.println("Er det her det er feil?");
  27. ps.executeUpdate();
  28. conn.commit();
  29. conn.close();
  30.  
  31. out.println("Lagt til " +title + " " +description+ " " +goals+ " " +task+ "");
  32.  
  33. } // end try // end try
  34. catch (Exception ex) {
  35. System.out.println(ex.getCause());
  36. System.out.println("error");
  37. out.println("Ikke hentet fra DB " +ex);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement