I want to display my results into a listbox  which I am unable to do so it
gives invalid cursor state

I tried the same code that I had used for displaying the contents of a table
,with the neccessary changes
for displaying it in a listbox
Please can anybody give a hint as to what could be the problem .


<HTML>                .
<BODY>
<%@ page import="java.sql.*" %>
<%! String dbURL="jdbc:odbc:bdayorcl";
    String dbCon="sun.jdbc.odbc.JdbcOdbcDriver";
    ResultSet result=null;
     %>
<jsp:useBean id="dbbean" class="db.DbBean" scope="session">
<jsp:setProperty name="dbbean" property="*"/>
</jsp:useBean>
<HR>
<BR><BR>
<% try{ dbbean.setDbDriver(dbCon);
  dbbean.setDbURL(dbURL);
  dbbean.connect();
  result=dbbean.execSQL("select * from dept");
%>
<h2 align=center>Tables Available :</h2>
<p><center> <select name=table size=15>
<option><%= result.getString(2)%>
   <% while(result.next())
   { %>
<option><%=result.getString(2)%>
  <% } %>
   </select></center></p>
<p><center><input type=submit value=Ok name=B1 style=width:80></center></p>
<% result.close();
  dbbean.close();
}catch(SQLException e)
  { throw new ServletException(e);
}
%>
</BODY>
</HTML>

P.s- the bean works since I tried it with my other code n works fine

TIA
Sanjay
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to