Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Sedrick Jefferson
Added: Apr 25, 2018 3:10 PM
Views: 4
SQLite PreparedStatement Select
  1. String sql = "Select * FROM Notes WHERE local_date_time = ?";        
  2. try (Connection conn = DriverManager.getConnection("jdbc:sqlite:calendarFx.db");
  3.          PreparedStatement pstmt = conn.prepareStatement(sql);
  4.          )
  5. {
  6.         pstmt.setString(1, ld.toLocalDate().toString());
  7.         ResultSet rs = pstmt.executeQuery();  
  8.         while(rs.next())
  9.         {
  10.                 tempList.add(new Label(rs.getString("note")));
  11.         }
  12. }    
  13. catch (SQLException ex) {    
  14.         Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex);
  15. }