Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 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 navn, beskrivelse, belastning, ant set, ant rep FROM treningsøkt natural join inneholder_øvelse natural join øvelse WHERE treningsøktID = insertID";
  20.  
  21. pst = con.prepareStatement(query);
  22.  
  23.  
  24. do {
  25. rs = pst.getResultSet();
  26.  
  27.  
  28.  
  29. System.out.print("Dint beste treningsøkt i perioden" + startdato "" + sluttdato "var");
  30.  
  31. System.out.println(rs.getString);
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38. } finally {
  39.  
  40. if (rs != null) {
  41. rs.close();
  42. }
  43.  
  44. if (pst != null) {
  45. pst.close();
  46. }
  47.  
  48. if (con != null) {
  49. con.close();
  50. }
  51.  
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement