|
|
| jsp |
Expert:vasu
Hi! Everybody...
I have two JSP pages. In 1st JSP i have two radio buttons i.e. university and college and one submit button. when user selects university and press submit in 2nd jsp i have to display university names. In the same way when user selects colleges i have to display college names from dbase. i am receiving the values in 2nd JSP. when i go to check condition i am getting "Error :[Microsoft][ODBC Driver Manager] Invalid cursor state"..
This is my code please verify....
if(request.getParameter("radios").equals("University")) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("Jdbc:Odbc:campus","jairam","ray"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from Universitydetails"); while(rs.next()); { uid=rs.getInt("UniversityID"); out.println(uid); uname=rs.getString("UniversityName"); out.println(uname); } stmt.close(); rs.close(); con.close(); } catch(Exception ex) { out.println("Error :"+ex.getMessage()); } }
else { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("Jdbc:Odbc:campus","jairam","ray"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select CollegeID,CollegeName from CollegeInfo"); while(rs.next()); { colid=rs.getString("CollegeID"); out.println(colid);%> <br> <% colname=rs.getString("CollegeName"); out.println(colname); } stmt.close(); rs.close(); con.close();
} catch(Exception ex) { out.println("Error :"+ex.getMessage()); }
}
%>
|
| Answers |
Hi friend,
Following points to be remember : *)You cannot reuse the Statement Handle when the cursor is in use in this memory table. *)As the resultset doesn't have the pointer on the first record.
For more information on JDBC visit to :
http://www.roseindia.net/jdbc/jdbc.shtml
Thanks
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|