Looking for help trying to find a given row in a preparedstatement in SQL. I have the SQL working. Giving me all the info I need but when I try to call it in JSP it only gives me the first row.
How can I call the next row?
I Call the info of the first row like this:
<%=mails.getString("Col 1")%>
<%=mails.getString("Col 2")%>
<%=mails.getString("Col 3")%>
....
<%=mails.getString("Col n")%>
=====================
extra info if anyone needs it:
mails is the ResultSet of
SELECT * FROM raw_purp_rec WHERE batchno=?;
output:
| Col 1 | Col 2 | Col 3|....| Col n |
Row1 1 A B . S
Row2 2 Z Z . Q
Row3 3 E M . L
....
Row7 7 W E . X
I want to get the info from more than the first row without ending the ResultSet.
Connection con = null;
PreparedStatement sendLogin = null;
ResultSet resultTest = null;
protected class Mail{
public Mail(){
try{
con = DriverManager.getConnection(URL,USERNAME,PASSWORD);
sendLogin = con.prepareStatement(
"SELECT * "
+ "FROM raw_purp_rec "
+ "where raw_purp_rec.batchno= ?;");
}catch(Exception e){
e.printStackTrace();
}
}
public ResultSet getMail(String thing){
try{
sendLogin.setString(1, thing);
resultTest = sendLogin.executeQuery();
}catch(Exception e){
e.printStackTrace();
}
return resultTest;
}
}
using a constructor of:
String packet = request.getParameter("name");
Mail mail = new Mail();
ResultSet mails = mail.getMail(packet);