Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. public static void main(String[] args) throws SQLException {
  2.  
  3. Connection con = null;
  4. PreparedStatement pst = null;
  5. ResultSet rs = null;
  6.  
  7.  
  8. String cs = "URL";
  9. String user = "nina";
  10. String password = "ninaerkul";
  11. Public double startdato;
  12. Public double sluttdato;
  13.  
  14.  
  15. try {
  16.  
  17. con = DriverManager.getConnection(cs, user, password);
  18.  
  19. String query = "SELECT notat FROM treningsøkt WHERE prestasjon =
  20. (SELECT max(prestasjon) from treningsøkt and startdato =< dato =< sluttdato";
  21.  
  22. pst = con.prepareStatement(query);
  23.  
  24.  
  25. do {
  26. rs = pst.getResultSet();
  27.  
  28.  
  29.  
  30. System.out.print("Dint beste treningsøkt i perioden" + startdato "" + sluttdato "var");
  31.  
  32. System.out.println(rs.getString);
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39. } finally {
  40.  
  41. if (rs != null) {
  42. rs.close();
  43. }
  44.  
  45. if (pst != null) {
  46. pst.close();
  47. }
  48.  
  49. if (con != null) {
  50. con.close();
  51. }
  52.  
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement