Advertisement
dzimen

Untitled

Dec 12th, 2018
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. @RequestMapping(value = "/updateProgram", method = RequestMethod.POST)
  2. @ResponseBody
  3. public String updateProgram(@RequestParam("name") String ProgramName,
  4. @RequestParam("description") String Description,
  5. @RequestParam("date") String DateTime,
  6. @RequestParam("user") String Users,
  7. @RequestParam("path") String ProgramPath,
  8. @RequestParam("active") Boolean Active,
  9. @RequestParam("seq") String Sequency,
  10. @RequestParam("topic") String Topic) {
  11.  
  12. PreparedStatement stmt = null;
  13. try {
  14. Connection dbConnection = DriverManager.getConnection(
  15. "jdbc:sqlserver://database_url;database_name", "user", "password");
  16. String sql = "UPDATE dbo.vs_srv_programList SET programName_s=?, description_s=?, langId_s=?, dateEvt=?, userId_s=?, pathToProgram=?, active_b=?, seq_i=?, topic=? WHERE programId_i=?";
  17. stmt = dbConnection.prepareStatement(sql);
  18.  
  19. stmt.setString(1, ProgramName);
  20. stmt.setString(2, Description);
  21. stmt.setDate(3, Date.valueOf(DateTime));
  22. stmt.setString(4, Users);
  23. stmt.setString(5, ProgramPath);
  24. stmt.setBoolean(6, Active);
  25. stmt.setString(7, Sequency);
  26. stmt.setString(8, Topic);
  27.  
  28. stmt.executeUpdate();
  29.  
  30. stmt.close();
  31.  
  32. } catch (SQLException e) {
  33. e.printStackTrace();
  34. }
  35. // return "OK";
  36. return "program-list.page";
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement