stmt.executeQuery(sql) never returns a null resultset. ResultSet.next() method will tell you if there are any rows returned.
>>> Isak Rickyanto <[EMAIL PROTECTED]> 10/25 3:08 PM >>> Hello all .... I want to ask about this code... This code get resultset from database,,, but if it is null (the null result set) doesn't run the code in the else section I can't understand what is the problem ... If I use sql tag or not... those have same result... the code in else don't run.... :< .. Please help me..... :< the code : Statement stmt=myConn.createStatement(); ResultSet myResultSet=stmt.executeQuery("select nama from user where id='"+login+"' and pass='"+pass+"' "); if (myResultSet != null) { while ( myResultSet.next() ) { String nama= myResultSet.getString("nama"); %> <tr> <td><%= nama %></td> </tr> // memulai session <% session.setAttribute ("user", nama); %> <jsp:forward page="browsevcd.jsp" /> <% } } else if (myResultSet == null) { %> <jsp:include page="header.htm" flush="true"/> <table> <tr><td colspan="2">Tabel</td></tr> <% out.println("You are not logged in"); %> </table> <jsp:include page="footer.htm" flush="true"/> <% } stmt.close(); myConn.close(); %> ==========================================================================To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com