Stretchwickster
Programmer
Hi,
I'm just starting out with Java servlets and I'm having a problem with something that should be simple.
I've made the following declaration of a resultset variable:
Further on in my servlet I execute a select query:
I then run a while loop to iterate through and display the query results in an html table:
I can retrieve the title, author and price strings without a problem, but the servlet bombs out when it reaches the first line in the while loop (which I have now commented). Instead, I've hard-coded stored_bookid to test that the rest of my code works - and it does. It's just when I use getInt that the program flies out into a catch statement. Anyone got any ideas?
Clive
I'm just starting out with Java servlets and I'm having a problem with something that should be simple.
I've made the following declaration of a resultset variable:
Code:
ResultSet rs = null;
Code:
rs = stmt2.executeQuery(SQLStatement);
I then run a while loop to iterate through and display the query results in an html table:
Code:
while ( rs.next() )
{
//stored_bookid = rs.getInt("bookid");
stored_bookid = 1;
stored_title = rs.getString("title");
stored_author = rs.getString("author");
stored_price = rs.getString("price"); out.println("<TR><TD><FONT COLOR='#FFFFFF'>" + stored_title + "</FONT></TD>" );
...
}
Clive