import java.io.*; import java.sql.*; import java.text.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class UuedVaprad extends HttpServlet { public void doGet(HttpServletRequest kysimus, HttpServletResponse vastus) throws IOException, ServletException { try{ ResourceBundle rb = ResourceBundle.getBundle("LocalStrings",kysimus.getLocale()); vastus.setContentType("text/html"); PrintWriter out = vastus.getWriter(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn=DriverManager.getConnection("jdbc:odbc:Baas1"); Statement st=cn.createStatement(); Statement tt=cn.createStatement(); out.println(""); out.println(""); out.println(" Alustame uut hääletust! "); out.println(""); out.println(""); out.println(""); out.println("

Alustame uut hääletust

"); out.println("

<< Tagasi edetabelisse

"); out.println(""); out.println(""); String paring = "UPDATE vaprad SET hinnatud=0;"; st.executeUpdate(paring); String paring2 = "SELECT TOP 2 * FROM abi ORDER BY keskmine ASC, esitaja DESC;"; ResultSet rs=st.executeQuery(paring2); while(rs.next()){ int id = rs.getInt("id"); String paring3 = "DELETE * FROM vaprad WHERE id="+id+";"; tt.executeUpdate(paring3); } cn.close(); }catch (Exception viga){viga.printStackTrace();} } }// Java Document