Code example for PreparedStatement

Methods: executeQuerysetIntclose

0
		q = q.replace("LIMIT ? OFFSET ?;", "");
		q = countQ.replace("@query@", q);
		 
		try { 
			st = con.prepareStatement(q);
			st.setInt(1, month);
		    st.setInt(2, year);
		    rs = st.executeQuery();
		     
		    if(rs.next()) {
		    	count = rs.getInt(1);
		    } 
		} catch(SQLException e) {
			throw e;
		} finally { 
			if (st != null) st.close();		
			if (rs != null) rs.close();
		} 
		 
		return count;
	} 
Stop searching for code, let great code find you!  Add Codota to your java IDE