See the code below, it does not work if there is a
single row in the result set; in other words the
statement if(!rs.next()) causes a row of result set to
be skipped.
Any suggestions ?,
Sunil.
ResultSet rs = ps.executeQuery();
if(!rs.next())
System.out.println("empty result set");
while(rs.next())
{
System.out.println(rs.getString
("EMPLOYEE_NAME"));
}
--- Satyanarayan Divakar
<[EMAIL PROTECTED]> wrote:
> if(!resultSet.next())
> display"No Records Retreived";
>
> -----Original Message-----
> From: sunil_s23 [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 18, 2001 10:27 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Checking for Empty Result Set
>
>
> Hi All,
> A ResultSet is never null once we execute a
> PreparedStatement and assign the result to the
> Result
> Set.
> Is there any other way of checking whether a
> ResultSet
> is empty ?
> Thanks,
> Sunil.
> --- King Maurice <[EMAIL PROTECTED]> wrote:
> > IF RESULTSET IS EQUAL TO NULL
> > DO SOMETHING,
> > SUGGESTION:: NO RECORDS FOUND PLEASE TRY AGAIN
> >
> >
> > ----- Original Message -----
> > From: "sunil_s23" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, June 18, 2001 11:00 AM
> > Subject: Checking for Empty Result Set
> >
> >
> > > Hello,
> > > Which is the best method for checking whether a
> > Result
> > > Set is empty ?
> > >
> > > ResultSet rs = prestmt.exeucteUpdate();
> > > Checking for rs.isBeforeFirst() returning false
> > does
> > > not seem to work always....
> > > Thanks in advance,
> > > Sunil.
> > >
> > >
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Spot the hottest trends in music, movies, and
> > more.
> > > http://buzz.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
> > >
> >
> >
>
===========================================================================
> > 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!?
> Spot the hottest trends in music, movies, and more.
> http://buzz.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
>
>
===========================================================================
> 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!?
Spot the hottest trends in music, movies, and more.
http://buzz.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