Nick
Posts: 9
Nickname: nicolashad
Registered: Jul, 2004
|
|
Re: NOW
|
Posted: Jul 12, 2004 12:47 AM
|
|
Hi,I've wrote this:
% java.sql.Connection conn = java.sql.DriverManager.getConnection((String) request.getAttribute("DBConnectio n"), "", ""); sql.PreparedStatement ps = conn.prepareStatement("select * from percorsi); java.sql.ResultSet rs = ps.executeQuery(); while (rs.next()) { String id = (String) rs.getString(1); String e = (String) rs.getString(5); Date E = Date.valueOf(e); String t = (String) rs.getString(9);/*take the date of system know as "now"..*/ Date T = Date.valueOf(t); if (E.before(T) =true) {
java.sql.PreparedStatement ps2 = conn.prepareStatement("update percorsi set stato = ? where id_percorso = ?"); ps2.setString(1, "N"); ps2.setString(2, id); int result2 = ps2.executeUpdate();
rs2.close(); ps2.close(); } rs.close(); ps.close();
|
|