Juan Carlos:

When you work with ResultSets you should know the
following:

 - a ResultSet has a row before the first one, this is
the one where you are positioned every time you
execute a query.
 - a ResultSet also has a after last row, this is the
one to insert rows in it.

So, look the following lines:

> String temp="";
> String depto="";
>
> String
> paisd=(String)rst_loc.getObject("PAIS_ORIGEN");

When you want to retrieve the first value you can't
(if you don't call next() or something like that
before) before you are currently on the before first
row and there is no data. On the next lines you call
next() and in that way you go forward on the data and
there is no problem.

You should put something like:
rst_loc.next() or rst_loc.first()

Hope this helps. This will be the solution if you
don't call any of this methods before the code you
gave to as.

Atilio


--- "Orozco, Juan Carlos" <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I have a problem with the resultSets, when i made
> the getObject method
> more than one time...example:
>
> String temp="";
> String depto="";
>
> String
> paisd=(String)rst_loc.getObject("PAIS_ORIGEN");
> <--may be here
>
>
> while (rst_loc_hasData)
> {
>
>             temp =
> (String)rst_loc.getObject("PAIS_ORIGEN"); <--here is
> the
> problem
>
>                 while (paisd.equals(temp))
>            {
>
>
> depto=(String)rst_loc.getObject("DEPARTAMENTO");
>                         %>
>
> listB.addOptions(<%=paisd%>,<%=depto%>,<%=depto%>);
> <-- my JavaScript function
>                         <%
>                         rst_loc_hasData =
> rst_loc.next();
>
> paisd=(String)rst_loc.getObject("PAIS_ORIGEN");
>                 }
> }
> rst_loc.close();
> rst_loc = Statementrst_loc.executeQuery();
> rst_loc_hasData = rst_loc.next();
> rst_loc_isEmpty = !rst_loc_hasData;
> %>
>
> I don't know why... and is the same thing when i am
> populate a listbox
>
>
>
> <%
>                         String pais = "";
>     <-- I have to
> declare this variables because i can't use getObject
> method
> String pais_iso = "";
>                         while (rst_paises_hasData)
>                         {
>                                 pais =
> (String)rst_paises.getObject("PAIS");
>                                 pais_iso =
> (String)rst_paises.getObject("PAIS_ORIGEN");
>                         %>
>                       <option
> value="<%=pais_iso%>"><%=pais%></option>
> <-- i must can
> put(String)rst_paises.getObject("PAIS_ORIGEN")
> directly
>           <%
>                                 rst_paises_hasData =
> rst_paises.next();
>                         }
>                         rst_paises.close();
>                         rst_paises =
> Statementrst_paises.executeQuery();
>                         rst_paises_hasData =
> rst_paises.next();
>                         rst_paises_isEmpty =
> !rst_paises_hasData;
>                 %>
>
>
> Thanks a lot friends..!!
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body:
> "set JSP-INTEREST DIGEST".
> 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


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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