I saw a lot of guides here, that says
if (!res.next())
should check if statement is empty, but when I do it I get this error
org.apache.jasper.JasperException: An exception occurred processing JSP page /irasyti.jsp at line 73
70: String rezervbusena=""; // rezervo busenos info
71: String uzsakymas=""; // uzsakymas info
72:
73: if( !res.next()){ //jei kambariai neuzimti
74: try {
I don't know what is wrong; maybe I need to import some utility? :/ my code:
ResultSet res = null;
Statement stmt = null;
try {
stmt = connection.createStatement();
//res=stmt.executeQuery
String tas=("SELECT * from table");
res=stmt.executeQuery(tas);
out.println("<br>tas: "+tas + "<br>");
}catch(Exception ex){
out.println("Klaida skaityme: "+ex);
}
if( !res.next()){ //jei kambariai neuzimti
try {}
catch(Exception ex){
out.println("error: "+ex);
}
}
error was that res resultset was null and after mysql return empty statment it stays null so i had to check if its null first if(res!=null)
thank yuo all for answering