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();
%>

Reply via email to