ResultSets should be used left-to-right, top-to-bottom. There is no
guarantee that once a row/column has bee readm that it can be re-read. Also
there is no guarantee that columns can be read out of order (i.e.
rs.getString(2); rs.getString(1); will probably fail). From the help

'. For maximum portability, result set columns within each row should be
read in left-to-right order, and each column should be read only once. '

Kevin Jones
DevelopMentor
www.develop.com

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Kai Hackemesser
> Sent: 18 September 2000 14:09
> To: [EMAIL PROTECTED]
> Subject: A question about ResultSets
>
>
> Hi!
>
> I have found that I can't ask the same Recordset field two times with
> getString() or equals. I get the SQL exception "no Data" on second try. Is
> this a rule or a mistake on my side?
>
> here is some code where it happens:
>
> try {
>  String RSTB3000_Query = "SELECT ROUTING_AREA FROM TRADIUS.RSTB3000";
>  rs = stmt.executeQuery(RSTB3000_Query);
>  while(rs.next())
>  {
>   String selektiert = "";
>   String Typ = rs.getString("ROUTING_AREA");
>   if (Typ == "AGB     ")
>  {
>    selektiert = " selected";
>   }
>   out.println("\t\t\t\t<option value=\"" + Typ + selektiert
>    + "\">" + Typ);
>  }
>  rs.close();
> } catch(SQLException ex) {
>  out.println("SQLException: " + ex.getMessage());
> }
>
> As you can see, I now create a String variable 'Typ' with the content of
> ROUTING_AREA, for not getting that error, but if I replace 'Typ' with
> rs.getString("ROUTING_AREA"), after second appearance I got 'no data'.
>
> ==================================================================
> =========
> 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

===========================================================================
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