Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

New JSP Problem

Options
  • 13-03-2002 12:56pm
    #1
    Registered Users Posts: 26


    It seems I fixed that last problem but now I'm back to my old problem of the dynamic menus where it says ther is no data for the menu:

    javax.servlet.ServletException: No data found

    My Code

    <select name="listfromMenu">
    <%
    while (rsGPS_hasData) {
    %>
    <option value="<%=((rsGPS.getObject("Name")!=null)?rsGPS.getObject("Name"):"")%>"><%=((rsGPS.getObject("Name")!=null)?rsGPS.getObject("Name"):"")%></option>
    <%
    rsGPS_hasData = rsGPS.next();
    }
    rsGPS.close();
    rsGPS = StatementrsGPS.executeQuery();
    rsGPS_hasData = rsGPS.next();
    rsGPS_isEmpty = !rsGPS_hasData;
    %>
    </select>


Comments

  • Registered Users Posts: 1,994 ✭✭✭lynchie


    You are trying to retrieve stuff from your ResultSet before you have even called executeQuery on it. The basic format of reading data from the DB is as follows

    Connection conn = DriverManager.getConnection(url,user,password);
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select a from b where c=d");
    while(rs.next())
    {
    Object o = rs.getObject("a");
    }
    rs.close();
    stmt.close();
    conn.close();


Advertisement